Last active
July 26, 2019 22:39
-
-
Save devxom/e040b9cb00c281b2bf0f3837740b3d53 to your computer and use it in GitHub Desktop.
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 getScrollTopPosition(){ | |
return document.documentElement.scrollTop || document.body.scrollTop || document.body.scrollTop || window.pageYOffset || 0; | |
} | |
// because it's so fucking difficult to detect the scrolling element, just move them all | |
function moveToScrollTop(amount) { | |
document.documentElement.scrollTop = amount; | |
document.body.parentNode.scrollTop = amount; | |
document.body.scrollTop = amount; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment