Show navigation on scroll up

Marko Krstić
6 Jan 2020
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var currentScrollPos = window.pageYOffset;
  if (prevScrollpos > currentScrollPos) {
    var element = document.getElementById("_header_row-335-8");
  	element.classList.add("mystyle");
  } else {
    var element = document.getElementById("_header_row-335-8");
  	element.classList.remove("mystyle");
  }
  prevScrollpos = currentScrollPos;
}

Was this article helpful?

Tags

Categories

Never miss new post again

Subscribe and get list of new posts in your inbox

Click to Copy