Created
January 5, 2019 09:25
-
-
Save Tsunamijaan/848cc228e208bb66d3138bbf2a65b3c6 to your computer and use it in GitHub Desktop.
Sticky header after scroll
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
$(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