File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717<script src="../gitbook/gitbook-plugin-search/search.js"></script>
1818-->
1919
20+ < script src ="{{site.baseurl}}/assets/gitbook/custom.js "> </ script >
21+ < script src ="{{site.baseurl}}/assets/gitbook/custom-local.js "> </ script >
22+
2023{% if site.extra_footer_js %}
2124 {%- for extra_js in site.extra_header_js -%}
2225 {%- assign starts_with = extra_js | slice: 0,4 -%}
Original file line number Diff line number Diff line change 1212 $ ( element ) . closest ( 'li.chapter' ) . find ( 'ul>li' ) . removeClass ( 'active' ) ;
1313 $ ( element ) . parent ( ) . addClass ( 'active' ) ;
1414 if ( $ ( document ) . width ( ) <= 1240 ) {
15- $ ( 'div.body-inner' ) . animate ( { scrollTop : $ ( $ ( element ) . attr ( 'href' ) ) . get ( 0 ) . offsetTop } ) ;
15+ let target = $ ( $ ( element ) . attr ( 'href' ) ) ;
16+ if ( target . length ) {
17+ $ ( 'div.body-inner' ) . animate ( {
18+ scrollTop : target . get ( 0 ) . offsetTop ,
19+ } ) ;
20+ }
1621 }
1722 return true ;
1823 }
Original file line number Diff line number Diff line change 1+ // Enable footnote link support for pages with width < 1240.
2+ //
3+ function bind_footnote_links ( ) {
4+ if ( $ ( document ) . width ( ) > 1240 ) {
5+ return ;
6+ }
7+ let footnotes = $ ( "div.footnotes" ) . find ( "ol > li > p > a.reversefootnote" ) ;
8+ for ( let i = 0 ; i < footnotes . length ; i ++ ) {
9+ let footnote = footnotes [ i ] ;
10+ footnote . addEventListener ( 'click' , function ( e ) {
11+ e . preventDefault ( ) ;
12+ var target = $ ( $ ( this ) . attr ( 'href' ) ) ;
13+ if ( target . length ) {
14+ $ ( 'div.body-inner' ) . animate ( {
15+ scrollTop : target . get ( 0 ) . offsetTop ,
16+ } ) ;
17+ }
18+ } ) ;
19+ }
20+ }
21+
22+ if ( document . readyState === "loading" ) {
23+ // Loading hasn't finished yet
24+ document . addEventListener ( "DOMContentLoaded" , bind_footnote_links ) ;
25+ } else {
26+ // `DOMContentLoaded` has already fired
27+ bind_footnote_links ( ) ;
28+ }
29+
You can’t perform that action at this time.
0 commit comments