Skip to content

Commit aef3854

Browse files
fix: Use relative position for toc indicator during scroll on mobile (#396)
Co-authored-by: Robert Schuster <77234379+therobrob@users.noreply.github.com>
1 parent 18b76fa commit aef3854

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

assets/sass/contentNavigation.scss

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
flex-wrap: wrap;
1313
height: fit-content;
1414

15-
ul,
16-
ol {
15+
ul {
1716
list-style-type: none;
1817
list-style-position: outside;
1918
padding-left: 0;
2019

21-
ul,
22-
ol {
20+
ul {
2321
margin-bottom: 0;
2422
}
2523
}
@@ -54,11 +52,33 @@
5452
list-style-type: none;
5553
}
5654

57-
ol {
55+
ul {
5856
padding: 0 0 0 1em;
5957
}
6058

61-
> ol {
59+
ul a[data-current]::before {
60+
left: -2.1rem;
61+
}
62+
63+
ul ul a[data-current]::before {
64+
left: calc(-1em - 2.1rem);
65+
}
66+
67+
a[data-current] {
68+
font-weight: bold;
69+
position: relative;
70+
71+
&:before {
72+
content: "";
73+
width: 0.4rem;
74+
height: 2.1rem;
75+
position: absolute;
76+
display: flex;
77+
background-color: var(--link-default);
78+
}
79+
}
80+
81+
> ul {
6282
padding-left: 0;
6383
}
6484
}
@@ -67,20 +87,6 @@
6787
display: flex;
6888
}
6989

70-
.o-aside__toc a[data-current] {
71-
font-weight: bold;
72-
73-
&:before {
74-
content: "";
75-
width: 0.4rem;
76-
height: 2.1rem;
77-
position: absolute;
78-
display: flex;
79-
left: 0;
80-
background-color: var(--link-default);
81-
}
82-
}
83-
8490
.o-related {
8591
&__list {
8692
list-style-type: none;
@@ -144,8 +150,6 @@
144150
background: var(--bg-default);
145151
overflow-y: scroll;
146152
overscroll-behavior-y: contain;
147-
border-left: var(--border);
148-
border-right: var(--border);
149153

150154
.o-single__container {
151155
border: none;
@@ -162,8 +166,10 @@
162166
flex-direction: column;
163167
gap: 1.5rem;
164168
width: 100%;
165-
border: var(--border);
169+
border-top: var(--border);
166170
border-bottom: 1px solid #3d444d;
171+
border-left: none;
172+
border-right: none;
167173
padding: 1rem;
168174
height: 6.4rem;
169175
border-radius: 1rem 1rem 0 0;

layouts/partials/toc.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@
7676
>{{ .Title | plainify | safeHTML }}</a
7777
>
7878
{{- with and (lt .Level $ctx.endLevel) .Headings }}
79-
<ol>
79+
<ul>
8080
{{- $ctx = merge $ctx (dict "headings" .) }}
8181
{{- partial "inline/toc/walk.html" $ctx }}
82-
</ol>
82+
</ul>
8383
{{- end }}
8484
</li>
8585
{{- else }}

0 commit comments

Comments
 (0)