Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Created January 20, 2022 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulieScanlon/1d7593c30de4e3e1c6cdf721f1175376 to your computer and use it in GitHub Desktop.
Save PaulieScanlon/1d7593c30de4e3e1c6cdf721f1175376 to your computer and use it in GitHub Desktop.
onRouteUpdate - jumplinks
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