Skip to content

Instantly share code, notes, and snippets.

@barlas
Created November 27, 2014 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barlas/776cae956ef2185b63ed to your computer and use it in GitHub Desktop.
Save barlas/776cae956ef2185b63ed to your computer and use it in GitHub Desktop.
jQuery - Detecting user's scrolling down or up.
var currentScroll = 0;
$(window).scroll(function() {
var nextScroll = $(this).scrollTop();
if ( nextScroll > currentScroll ) {// scroll down
}else{// scroll up
}
currentScroll = nextScroll;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment