Last active
December 23, 2018 15:09
-
-
Save ron4stoppable/750381b30bd145c44d1f48729fc0124f to your computer and use it in GitHub Desktop.
Get proper scroll/page-offset value, works in all browsers, over all platforms (as far as I have tested)
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
// to get proper scroll/page-offset value | |
// works in all browsers, over all platforms (as far as I have tested) | |
// this basically is for the different property in iOS browser & Safari | |
const scrollTop = Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment