Created
June 23, 2017 13:17
-
-
Save joviczarko/868342655e5da8f9a3d9f6973da6f2cb to your computer and use it in GitHub Desktop.
Navbar on scroll change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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