File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -38,18 +38,12 @@ document.addEventListener('click', (e) => {
3838} ) ;
3939
4040document . addEventListener ( 'DOMContentLoaded' , ( ) => {
41- // need to correlate path to page rather than h1, as headers can be repeated (ie. nested1c/nested2-1 is seen the same as nested1b/nested2-1)
42- const currentPage = document . querySelector ( "h1" ) . textContent ;
43- console . log ( "This is a test log " + currentPage ) ;
44-
41+ const currentPage = window . location . href ;
4542 const match = Array . from ( document . querySelectorAll ( ".sidebar__link" ) )
46- . find ( el => el . textContent . includes ( currentPage ) ) ;
43+ . find ( el => el . href . includes ( currentPage ) ) ;
4744
48- if ( match ) {
49- console . log ( "Matching pair? " + match )
45+ if ( match )
5046 match . scrollIntoView ( { behavior : "instant" , block : "nearest" } ) ;
51- }
52-
5347} ) ;
5448
5549const debounce = ( callback , wait ) => {
You can’t perform that action at this time.
0 commit comments