Skip to content

Instantly share code, notes, and snippets.

@khikrama
Forked from raselahmed7/jquery-sticky-menu.js
Last active August 29, 2015 14:06
Show Gist options
  • Save khikrama/976eca03650afce22b95 to your computer and use it in GitHub Desktop.
Save khikrama/976eca03650afce22b95 to your computer and use it in GitHub Desktop.
// Sticky Header
$(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