File tree Expand file tree Collapse file tree 2 files changed +23
-12
lines changed Expand file tree Collapse file tree 2 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -554,3 +554,20 @@ div.highlight span.c-Singleline, div.highlight span.c {
554
554
}
555
555
}
556
556
}
557
+
558
+ /* hide TOC */
559
+ .hiddenTOC {
560
+ font-size : 0 ;
561
+ margin : 0 ;
562
+ opacity : 0 ;
563
+ padding : 0 ;
564
+ /* fade out, then shrink */
565
+ transition : opacity .25s , font-size .5s .25s , margin .5s .25s , padding .5s .25s ;
566
+
567
+ }
568
+
569
+ /* reveal TOC */
570
+ .shownTOC {
571
+ /* unshrink, then fade in */
572
+ transition : font-size .25s , margin .25s , padding .25s , opacity .5s .25s ;
573
+ }
Original file line number Diff line number Diff line change @@ -39,7 +39,9 @@ function setup_collapsible_TOC() {
39
39
40
40
state = Cookies . get ( 'toc_state' ) || 'shown' ;
41
41
if ( state == 'hidden' ) {
42
- $ ( 'nav.indexgroup > ol' ) . hide ( ) ;
42
+ $ ( '#TOC' ) . find ( 'tbody' ) . addClass ( 'hiddenTOC' ) ;
43
+ } else {
44
+ $ ( '#TOC' ) . find ( 'tbody' ) . addClass ( 'shownTOC' ) ;
43
45
}
44
46
45
47
$ ( 'nav.indexgroup' ) . find ( '#TOC_Title' )
@@ -51,17 +53,9 @@ function setup_collapsible_TOC() {
51
53
. find ( '#TOC_toggle_button' )
52
54
. click ( function ( ) {
53
55
var el = $ ( this ) ;
54
- if ( el . text ( ) == '[hide]' ) {
55
- Cookies . set ( 'toc_state' , 'hidden' ) ;
56
- el . parents ( 'nav' ) . find ( 'tbody' ) . slideUp ( ) ;
57
- el . text ( '[show]' ) ;
58
- }
59
- else {
60
- Cookies . set ( 'toc_state' , 'shown' ) ;
61
- el . parents ( 'nav' ) . find ( 'tbody' ) . slideDown ( ) ;
62
- el . text ( '[hide]' ) ;
63
- }
64
-
56
+ el . text ( el . text ( ) == '[hide]' ? '[show]' : '[hide]' ) ;
57
+ Cookies . set ( 'toc_state' , el . text ( ) == '[hide]' ? 'shown' : 'hidden' ) ;
58
+ el . parents ( 'nav' ) . find ( 'tbody' ) . toggleClass ( 'hiddenTOC' ) . toggleClass ( 'shownTOC' ) ;
65
59
return false ;
66
60
} ) ;
67
61
}
You can’t perform that action at this time.
0 commit comments