Created
June 26, 2018 07:43
-
-
Save geraldyeo/e0959010b1fc596ab1d0284d4f9c7834 to your computer and use it in GitHub Desktop.
cross browser scrolltop
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
function getBodyScrollTop() { | |
const el = document.scrollingElement || document.documentElement; | |
return Math.max(window.pageYOffset, el.scrollTop); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment