Created
June 7, 2016 15:31
-
-
Save rbk/52708232700358a53165d5a71dae08d7 to your computer and use it in GitHub Desktop.
Cross browser scroll position
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
// Calculate scroll position in all IE9+ Firefox, Chrome, and Edge | |
var scrollTop = 0; | |
window.addEventListener('scroll', function(e){ | |
scrollTop = document.documentElement.scrollTop || window.scrollY; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment