data-scroll="navbar"
.transform
style to hide on scroll-down and show on scroll-up.To create a navbar that hides on scroll-down and shows on scroll-up in Webflow, you'll need to use custom JavaScript in combination with Webflow’s native interactions system for visibility settings.
Div Block
.scroll-navbar
.data-scroll
navbar
</body>
tag:<script>let lastScrollTop = 0;const navbar = document.querySelector('[data-scroll="navbar"]');window.addEventListener("scroll", function() { const scrollTop = window.pageYOffset || document.documentElement.scrollTop; if (scrollTop > lastScrollTop) { // Scrolling down navbar.style.transform = "translateY(-100%)"; navbar.style.transition = "transform 0.3s ease"; } else { // Scrolling up navbar.style.transform = "translateY(0)"; navbar.style.transition = "transform 0.3s ease"; } lastScrollTop = scrollTop <= 0 ? 0 : scrollTop;}, false);</script>
Move
Y to 0px
.To implement a responsive scroll-up show / scroll-down hide navbar, use custom JavaScript to detect scroll direction and apply transform styles to the navbar using a unique selector. Combine this with a fixed navbar and transitions to ensure smooth animations.