The Navigation component provides a fixed header with desktop menu, language switcher, and mobile overlay menu. It features smart hide/show behavior on scroll and smooth animations.
The component uses GSAP and vanilla JavaScript for interactions:
Scroll Behavior
Mouse Hover
Mobile Menu
let lastScrollTop = 0;const threshold = 50;window.addEventListener('scroll', () => { const st = window.scrollY; if (st < 10) { nav?.classList.remove('nav-hidden'); return; } if (Math.abs(lastScrollTop - st) <= threshold) return; if (st > lastScrollTop) { // Scroll Down -> Hide nav?.classList.add('nav-hidden'); } else { // Scroll Up -> Show nav?.classList.remove('nav-hidden'); } lastScrollTop = st;});
// Show nav when mouse is near topdocument.addEventListener('mousemove', (e) => { if (e.clientY < 100) { nav?.classList.remove('nav-hidden'); }});
hamburger?.addEventListener('click', () => { document.body.classList.toggle('menu-open');});// Close menu when link is clickedoverlayLinks.forEach((link) => { link.addEventListener('click', () => { document.body.classList.remove('menu-open'); });});