Skip to content

Instantly share code, notes, and snippets.

@joviczarko
Created June 23, 2017 13:17
Show Gist options
  • Save joviczarko/868342655e5da8f9a3d9f6973da6f2cb to your computer and use it in GitHub Desktop.
Save joviczarko/868342655e5da8f9a3d9f6973da6f2cb to your computer and use it in GitHub Desktop.
Navbar on scroll change
(function($) {
$(window).scroll(function() {
var height = $(window).height();
if ($(window).scrollTop() / 2 > height) {
$('#header-nav').addClass('scrolled-navbar');
}
else {
$('#header-nav').removeClass('scrolled-navbar');
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment