-
-
Save anonymous/fcbb946c6d9aa8624771 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(e) { | |
//hide menu | |
var lastScrollTop, incr = 0; | |
var menuSpace = 20; startsOn = 80; | |
$(window).scroll(function(event) { | |
var st = $(this).scrollTop(); | |
if (st > startsOn) { | |
if (st > lastScrollTop) { | |
incr += 1; | |
if (incr >= menuSpace) { | |
$(".topMenu").addClass("hide"); | |
incr = menuSpace; | |
} | |
} else { | |
incr -= 1; | |
if (incr <= 5) { | |
$(".topMenu").removeClass("hide"); | |
incr = 0; | |
} | |
} | |
} else { | |
$(".topMenu").removeClass("hide"); | |
} | |
lastScrollTop = st; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment