@@ -68,26 +68,35 @@ <h3 style="margin-top: 1.5em;">{{ _('Search') }}</h3>
68
68
</ div >
69
69
70
70
< script type ="text/javascript ">
71
- // http://movethewebforward.org/
72
- // paul irish et al. we <3 you.
73
- var $body = $ ( document . body ) ;
74
-
75
- var $scrollable = $ ( window ) ; // default scrollable thingy, which'll be body or docEl (html)
76
- $originalnavtop = 52 ; //$scrollable.css('top');
77
-
78
- // work on scroll, but debounced
79
- var $document = $ ( document ) . scroll ( function ( ) {
80
- var $nav = $ ( "div.sphinxsidebar" ) ;
81
- if ( $scrollable . scrollTop ( ) > ( $originalnavtop - 20 ) ) {
82
- $nav . addClass ( 'sticky' ) . css ( 'top' , '0' ) ;
83
- $nav . addClass ( 'sticky' ) . css ( 'position' , 'fixed' ) ;
84
- } else {
85
- $nav . removeClass ( 'sticky' ) ;
86
- $nav . addClass ( 'sticky' ) . css ( 'position' , '' ) ;
87
- $nav . addClass ( 'sticky' ) . css ( 'top' , '' ) ;
88
- }
71
+ $ ( function ( ) {
89
72
90
- } ) ;
73
+ var chapter = window . location . href . split ( "/" ) . pop ( )
74
+ if ( chapter . indexOf ( "api.html" ) === 0 ) {
75
+ // don't sticky the nav when in the API doc,
76
+ // TOC too long to fit on screem
77
+ return
78
+ }
79
+ // http://movethewebforward.org/
80
+ // paul irish et al. we <3 you.
81
+ var $body = $ ( document . body ) ;
82
+
83
+ var $scrollable = $ ( window ) ; // default scrollable thingy, which'll be body or docEl (html)
84
+ $originalnavtop = 52 ; //$scrollable.css('top');
85
+
86
+ // work on scroll, but debounced
87
+ var $document = $ ( document ) . scroll ( function ( ) {
88
+ var $nav = $ ( "div.sphinxsidebar" ) ;
89
+ if ( $scrollable . scrollTop ( ) > ( $originalnavtop - 20 ) ) {
90
+ $nav . addClass ( 'sticky' ) . css ( 'top' , '0' ) ;
91
+ $nav . addClass ( 'sticky' ) . css ( 'position' , 'fixed' ) ;
92
+ } else {
93
+ $nav . removeClass ( 'sticky' ) ;
94
+ $nav . addClass ( 'sticky' ) . css ( 'position' , '' ) ;
95
+ $nav . addClass ( 'sticky' ) . css ( 'top' , '' ) ;
96
+ }
97
+
98
+ } ) ;
99
+ } )
91
100
</ script >
92
101
93
102
{%- endblock %}
0 commit comments