Skip to content

Instantly share code, notes, and snippets.

@raselahmed7
Created September 21, 2014 06:44
Show Gist options
  • Save raselahmed7/bc753838822456c35ca3 to your computer and use it in GitHub Desktop.
Save raselahmed7/bc753838822456c35ca3 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');
}
});
@ThemeMetric
Copy link

awesome

@eliashossain123
Copy link

thanks vai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment