Created
June 26, 2015 18:53
-
-
Save marcbacon/b5628d1230741057d4a4 to your computer and use it in GitHub Desktop.
Detect scroll direction using jQuery
This file contains hidden or 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
var iScrollPos = 0; | |
$(window).scroll(function () { | |
var iCurScrollPos = $(this).scrollTop(); | |
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