mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
13 lines
368 B
JavaScript
13 lines
368 B
JavaScript
|
function scrollToNavItem() {
|
||
|
var path = window.location.href.split('/').pop().replace(/\.html/, '');
|
||
|
document.querySelectorAll('nav a').forEach(function(link) {
|
||
|
var href = link.attributes.href.value.replace(/\.html/, '');
|
||
|
if (path === href) {
|
||
|
link.scrollIntoView({block: 'center'});
|
||
|
return;
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
scrollToNavItem();
|