Removed menu item highlighting due to one-pager.
This commit is contained in:
parent
d40b5c30a3
commit
90873afb36
1 changed files with 0 additions and 28 deletions
|
|
@ -3,11 +3,6 @@
|
||||||
*/
|
*/
|
||||||
const parallaxElems = document.querySelectorAll('.parallax');
|
const parallaxElems = document.querySelectorAll('.parallax');
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {NodeListOf<HTMLAnchorElement>}
|
|
||||||
*/
|
|
||||||
const navlinks = document.querySelectorAll('a.nav-link');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {NodeListOf<HTMLElement>}
|
* @type {NodeListOf<HTMLElement>}
|
||||||
*/
|
*/
|
||||||
|
|
@ -31,29 +26,6 @@ window.addEventListener('scroll', () =>
|
||||||
|
|
||||||
parallaxElem.style.top = `${(windowScroll - parentScroll) / 4}px`;
|
parallaxElem.style.top = `${(windowScroll - parentScroll) / 4}px`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Highlight menu item when scrolled to section.
|
|
||||||
let current = '';
|
|
||||||
sections.forEach(section =>
|
|
||||||
{
|
|
||||||
const rect = section.getBoundingClientRect();
|
|
||||||
const sectionTop = rect.top + window.scrollY;
|
|
||||||
|
|
||||||
if (window.scrollY >= sectionTop - 70)
|
|
||||||
{
|
|
||||||
current = section.getAttribute('id');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
navlinks.forEach(link =>
|
|
||||||
{
|
|
||||||
link.classList.remove('active');
|
|
||||||
|
|
||||||
if (link.getAttribute('href') === `#${current}`)
|
|
||||||
{
|
|
||||||
link.classList.add('active');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
sections.forEach(section =>
|
sections.forEach(section =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue