Request Tutorial - Show navbar on scroll-up and hide when scroll-down

Hi Webflow and Everyone

Does anyone know how to do this.
“Show navbar on scroll-up and hide when scroll-down”

Something like this

This is very helpful on mobile browsing.
The menu will hide once the user scroll to DOWN direction.
And will Show Menu once the user scroll to UP direction.

Thanks in advance.


Well, I have discovered how to do this.

I gave my nav bar an ID called MagicMenu
then just put this code in your custom footer and it will works just wonderful.

<script type="text/javascript">

// Hide #MagicMenu on on scroll down
var didScroll;
var lastScrollTop = 0;
var delta = 5;
var navbarHeight = $('#MagicMenu').outerHeight();

    didScroll = true;

setInterval(function() {
    if (didScroll) {
        didScroll = false;
}, 250);

function hasScrolled() {
    var st = $(this).scrollTop();
    // Make sure they scroll more than delta
    if(Math.abs(lastScrollTop - st) <= delta)
    // If they scrolled down and are past the navbar, add class .MagicMenu-up.
    // This is necessary so you never see what is "behind" the navbar.
    if (st > lastScrollTop && st > navbarHeight){
        // Scroll Down
    } else {
        // Scroll Up
        if(st + $(window).height() < $(document).height()) {
    lastScrollTop = st;

Full tutorial is here in this article


Hello @KMB,
Glad you figured it out. And thank you for sharing with community! :smiley:



Just in case, you have to add

<script src=""></script>

immediately before that code :wink:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.