Created
December 23, 2016 15:02
-
-
Save gwenf/bd0ba0a161e6eafa0e3d39e0d7c2f5fd to your computer and use it in GitHub Desktop.
Listen for Hash Change and 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
window.addEventListener("hashchange", scrollToTop, false); | |
function scrollToTop(){ | |
window.scrollTo(0, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment