Created
September 7, 2017 15:46
-
-
Save shabaz-ejaz/17b0c7b5c734917acd9ac6d7f93c1542 to your computer and use it in GitHub Desktop.
Sticky header after 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
| var stickyHeaderTop = $('#jetmenu').offset().top; | |
| $(window).scroll(function(){ | |
| if( $(window).scrollTop() > stickyHeaderTop ) { | |
| $('#jetmenu').css({position: 'fixed', top: '0px'}); | |
| $('#jetmenu').css('display', 'block'); | |
| } else { | |
| $('#jetmenu').css({position: 'static', top: '0px'}); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment