Last active
December 2, 2023 18:58
-
-
Save softiconic/5b0e31a5cd36b61e5a8475797f8b0358 to your computer and use it in GitHub Desktop.
Fixed header that remains sticky as you scroll.
This file contains hidden or 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
//**********Sticky Header********** | |
$(window).on('scroll', function (){ | |
var sticky = $('header'), | |
scroll = $(window).scrollTop(); | |
if (scroll >= 100) sticky.addClass('sticky'); | |
else sticky.removeClass('sticky'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment