Skip to content

Instantly share code, notes, and snippets.

@shahadat014
Created January 18, 2015 19:05
Show Gist options
  • Select an option

  • Save shahadat014/e5c55727114d1da3723d to your computer and use it in GitHub Desktop.

Select an option

Save shahadat014/e5c55727114d1da3723d to your computer and use it in GitHub Desktop.
Sticky header after scroll
$(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