Skip to content

Instantly share code, notes, and snippets.

@valivarthy
Created October 17, 2019 14:36
Show Gist options
  • Save valivarthy/dad008dd7193d59a660996569df21a05 to your computer and use it in GitHub Desktop.
Save valivarthy/dad008dd7193d59a660996569df21a05 to your computer and use it in GitHub Desktop.
Solving jumping Header
function headerSolver(){
var scrollPosition = document.documentElement.scrollTop;
if (scrollPosition > 75) {
$('header').css('position', 'fixed');
} else {
$('header').css('position', 'relative');
}
}
window.onscroll = function() {headerSolver()};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment