Skip to content

Instantly share code, notes, and snippets.

@mjinayan80
Forked from raselahmed7/jquery-sticky-menu.js
Created March 28, 2018 11:49
Show Gist options
  • Save mjinayan80/e12635b614b1908d9c3e872fc0557827 to your computer and use it in GitHub Desktop.
Save mjinayan80/e12635b614b1908d9c3e872fc0557827 to your computer and use it in GitHub Desktop.
jQuery sticky menu
// 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