Skip to content

Instantly share code, notes, and snippets.

@rbk
Created June 7, 2016 15:31
Show Gist options
  • Save rbk/52708232700358a53165d5a71dae08d7 to your computer and use it in GitHub Desktop.
Save rbk/52708232700358a53165d5a71dae08d7 to your computer and use it in GitHub Desktop.
Cross browser scroll position
// 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