File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 1
1
{% assign pagetype = page.type %}
2
2
< div class ="content-nav ">
3
- < div class ="inner-box sidebar-toc-wrapper {% if pagetype %}book{% endif %} " style ="">
3
+ < div class ="inner-box sidebar-toc-wrapper " style ="">
4
4
< h5 class ="contents "> Contents</ h5 >
5
5
{% if pagetype %}
6
6
< div class ="inner-toc book " id ="sidebar-toc ">
Original file line number Diff line number Diff line change 15
15
display : none ;
16
16
}
17
17
18
- // disable floating for the book, since the TOC can become very large
19
- & .book {
20
- position : relative ;
21
- }
22
-
23
18
.contents {
24
19
font-weight : 700 ;
25
20
}
28
23
.inner-toc {
29
24
max-height : 60vh ;
30
25
overflow-y : auto ;
26
+ position : relative ;
31
27
32
28
@include bp (large ) {
33
29
max-height : none ;
34
30
}
35
-
36
- & .book {
37
- max-height : none ;
38
- }
39
31
}
40
32
41
33
#toc {
Original file line number Diff line number Diff line change @@ -282,6 +282,11 @@ $(document).ready(function() {
282
282
autoId : true ,
283
283
numerate : false
284
284
} ) ;
285
+ const target = $ ( '#sidebar-toc .active' ) ;
286
+ if ( target . length ) {
287
+ const marginTop = $ ( '#sidebar-toc .type-chapter' ) . length ? 15 : 10 ;
288
+ $ ( '#sidebar-toc' ) . animate ( { scrollTop : target . position ( ) . top - marginTop } , 200 ) ;
289
+ } ;
285
290
}
286
291
} ) ;
287
292
You can’t perform that action at this time.
0 commit comments