Skip to content

Instantly share code, notes, and snippets.

@wireinet
Last active January 19, 2021 11:33
Show Gist options
  • Save wireinet/0a83345dd35825582ee4df2cc562d6f5 to your computer and use it in GitHub Desktop.
Save wireinet/0a83345dd35825582ee4df2cc562d6f5 to your computer and use it in GitHub Desktop.
// Show and hide mobile menu on scroll
$(document).ready(function(){
var mob_menu = $('.mobile-menu');
var lastScrollTop = 0;
$(window).scroll(function(event){
var st = $(this).scrollTop();
if (st > lastScrollTop){
mob_menu.addClass('scroll');
} else {
mob_menu.removeClass('scroll');
}
lastScrollTop = st;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment