Skip to content

Instantly share code, notes, and snippets.

@zetareticoli
Created May 15, 2014 12:31
Show Gist options
  • Save zetareticoli/0b2f94c6a4b503ea7728 to your computer and use it in GitHub Desktop.
Save zetareticoli/0b2f94c6a4b503ea7728 to your computer and use it in GitHub Desktop.
Add/Remove class when scrolling page
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 160) {
$(".primary-navbar").addClass("navbar-fixed-top");
}
else {
$(".primary-navbar").removeClass("navbar-fixed-top");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment