npm install @curi/side-effect-scroll
Prefer inline scripts? A full (
.umd.js) and minified (
.min.js) script is available for every version through Unpkg. You can access the package's exports using
When Curi is running in a browser, it relies on the History API to change locations, but this does not trigger scrolling to the top of the page when you navigate. This package provides a side effect function that will scroll to the top of the page whenever those functions are used for navigation.
Other types of navigation, such as clicking the browser's back and forward buttons, will rely on the browser to correctly restore the scroll position.