Skip to content

Instantly share code, notes, and snippets.

@joeydenbraven
Last active November 23, 2015 10:53
Show Gist options
  • Save joeydenbraven/9f6993a4c70d2ce6c327 to your computer and use it in GitHub Desktop.
Save joeydenbraven/9f6993a4c70d2ce6c327 to your computer and use it in GitHub Desktop.
jQuery script that will activate for scrolling up or down.
var iScrollPos = 0;
$(window).scroll(function () {
var iCurScrollPos = $(this).scrollTop();
if(iCurScrollPos<=300){
//Do nothing within 300px and down range
}
else {
var spacerheight = $('header').height();
if (iCurScrollPos > iScrollPos) {
//Scrolling Down
} else {
//Scrolling Up
}
iScrollPos = iCurScrollPos;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment