File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 5757 padding-left : 10px ;
5858 padding-bottom : 10px ;
5959 padding-top : 7rem ;
60+ height : calc (100vh - 138px );
61+ }
62+
63+ .md-nav--secondary .md-nav__title {
64+ position : relative;
6065}
6166
6267.md-nav--secondary > ul {
Original file line number Diff line number Diff line change @@ -133,4 +133,25 @@ $(document).ready(function() {
133133
134134 $ ( '.md-sidebar--primary .md-sidebar__scrollwrap' ) [ 0 ] . scrollTop =
135135 $ ( '.md-sidebar--primary .md-nav__item--active:not(.md-nav__item--nested)' ) [ 0 ] . offsetTop - 33 ;
136+
137+ $ ( document ) . scroll ( function ( ) {
138+ if ( $ ( '.md-sidebar--secondary .md-nav__link--active' ) . length ) {
139+ $ ( '.md-sidebar--secondary .md-nav__link--active' ) [ 0 ] . scrollIntoView ( {
140+ behavior : 'instant' ,
141+ block : 'nearest'
142+ } ) ;
143+ } else {
144+ $ ( '.md-sidebar--secondary .md-sidebar__scrollwrap' ) . scrollTop ( 0 ) ;
145+ }
146+ } ) ;
147+
148+ $ ( '.md-sidebar.md-sidebar--secondary nav a' ) . click ( function ( event ) {
149+ window . setTimeout ( function ( ) {
150+ $ ( '.md-sidebar--secondary .md-nav__link--active' ) . removeClass ( 'md-nav__link--active' ) ;
151+ $ ( event . target ) . addClass ( 'md-nav__link--active' ) ;
152+ $ ( document ) . scroll ( ) ;
153+ // Fix page TOC/hash bug
154+ document . location . hash = event . target . hash ;
155+ } , 500 ) ;
156+ } ) ;
136157} ) ;
You can’t perform that action at this time.
0 commit comments