Created
January 18, 2015 19:05
-
-
Save shahadat014/e5c55727114d1da3723d 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
| $(window).scroll(function() { | |
| if ($(window).scrollTop() > 100) { | |
| $('.main_h').addClass('sticky'); | |
| } else { | |
| $('.main_h').removeClass('sticky'); | |
| } | |
| }); | |
| if you want to add stick menu on custom div scroll | |
| $(window).scroll(function() { | |
| if ($("your_div").scrollTop() > 100) { | |
| $('.main_h').addClass('sticky'); | |
| } else { | |
| $('.main_h').removeClass('sticky'); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment