
EN
let lastScrollTop = 0; const navWrapper = document.querySelector(".nav-wrapper"); // Changed to target the nav-wrapper class window.addEventListener("scroll", function () { const safeSpace = 0; // Minimum distance from top before the navigation bar starts hiding let scrollTop = window.pageYOffset || document.documentElement.scrollTop; if (scrollTop > lastScrollTop && scrollTop > safeSpace) { // Scrolling down -> hide menu navWrapper.style.transform = "translateY(-100%)"; navWrapper.style.transition = "transform 0.3s ease-in-out"; } else { // Scrolling up -> show menu navWrapper.style.transform = "translateY(0)"; } lastScrollTop = scrollTop; });