Skip to content

Instantly share code, notes, and snippets.

@geraldyeo
Created June 26, 2018 07:43
Show Gist options
  • Save geraldyeo/e0959010b1fc596ab1d0284d4f9c7834 to your computer and use it in GitHub Desktop.
Save geraldyeo/e0959010b1fc596ab1d0284d4f9c7834 to your computer and use it in GitHub Desktop.
cross browser scrolltop
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