Scroll up/down navbar JS

Hello There,

I think it is a bit out of the scope, i still try it here, maybe you will be able to help me with a quick fix.
thanks a lot.

I am trying to get a navbar that is disappearing while scrolling down, and reappearing while scrolling up.

So far i tried this :
i’m using pro and my header bar is set to fixed

var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var currentScrollPos = window.pageYOffset;
if (prevScrollpos > currentScrollPos) {
document.getElementById(“x-bar”).style.top = “0”;
} else {
document.getElementById(“x-bar”).style.top = “-100px”;
}
prevScrollpos = currentScrollPos;
}

But it does not seems to work properly. Am i missing something obvisous ? thank you very much guys

Keep up the good work !

Hey @Thaelys,

Thanks for writing in! There could be a JS error on the page. You may need to contact the creator of the JS code for further support. Meanwhile, please provide the URL of the page where you have added JS code so we can check it.

Best Regards.

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