Created
March 13, 2014 11:24
-
-
Save squallstar/9526662 to your computer and use it in GitHub Desktop.
Best cross-device way to implement Javascript onScroll event on a browser
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
window.onscroll = function() { | |
var top = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop; | |
console.log(top); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment