Last active
November 13, 2019 22:55
-
-
Save Korveld/0463390c9ac443a5cf0ff20d5b93eb99 to your computer and use it in GitHub Desktop.
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 lastScrollTop = 0; | |
| $(window).scroll(function(event) { | |
| var st = $(this).scrollTop(); | |
| if (st > lastScrollTop) { | |
| //Scroll Down | |
| } | |
| else if (st == lastScrollTop) { | |
| //do nothing | |
| //In IE this is an important condition because there seems to be some instances where the last scrollTop is equal to the new one | |
| } | |
| else { | |
| //Scroll Up | |
| } | |
| lastScrollTop = st; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment