The package can be installed through
npm (you need to have Node & NPM installed).
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 through
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.