Created
January 20, 2022 12:37
-
-
Save PaulieScanlon/1d7593c30de4e3e1c6cdf721f1175376 to your computer and use it in GitHub Desktop.
onRouteUpdate - jumplinks
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
export const onRouteUpdate = ({ location }) => { | |
const jumplink = document.getElementById(location.hash) | |
if (jumplink) { | |
window.scrollTo({ | |
top: jumplink.offsetTop, | |
}) | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment