You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
368 B
13 lines
368 B
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();
|