Skip to content

Instantly share code, notes, and snippets.

@monkianer
Created July 31, 2017 14:53
Show Gist options
  • Save monkianer/1681e4eaba9d4073e09ca22407acc403 to your computer and use it in GitHub Desktop.
Save monkianer/1681e4eaba9d4073e09ca22407acc403 to your computer and use it in GitHub Desktop.
Fix the 'ie' is not compatible with window.scrollY
/**
* Fix the 'ie' is not compatible with window.scrollY
* test with ie 9, 10, 11, edge.
**/
function getScrollTop(){
var t = typeof window.scrollY === 'undefined' ? window.pageYOffset : window.scrollY;
return t;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment