Last active
April 27, 2017 11:53
-
-
Save MD4/f2ecd8146cee09f9852152d2d81f79f1 to your computer and use it in GitHub Desktop.
Really simple smooth scroll to top
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
const smoothScrollToTop = (element = document.body, interpolationFactor = 1.2) => | |
Math.round(element.scrollTop /= interpolationFactor) ? | |
setTimeout(smoothScrollToTop, 16.666, element) && true : false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment