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) => {
38
38
} ) ;
39
39
40
40
document . 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 ;
45
42
const match = Array . from ( document . querySelectorAll ( ".sidebar__link" ) )
46
- . find ( el => el . textContent . includes ( currentPage ) ) ;
43
+ . find ( el => el . href . includes ( currentPage ) ) ;
47
44
48
- if ( match ) {
49
- console . log ( "Matching pair? " + match )
45
+ if ( match )
50
46
match . scrollIntoView ( { behavior : "instant" , block : "nearest" } ) ;
51
- }
52
-
53
47
} ) ;
54
48
55
49
const debounce = ( callback , wait ) => {
You can’t perform that action at this time.
0 commit comments