EvoToolkit - v3.0.0 (Changelog)


A helper function allowing you to trigger an animated scroll to either a specific element or the top of the page.

For a more ready made implementation of this tool, see the clickScroll module.



Luke Harrison


When importing EvoToolkit directly as a compiled .js file without a build step, you can still use these tools through the global EvoToolkit object.

import scrollTo from './../../../node_modules/evotoolkit/src/js/tools/scrollTo.js'; const myElem = document.querySelector('.js-my-elem'); // Scrolls to myElem, with the top of the element touching the top of the viewport scrollTo(myElem) // Scrolls to a point 30px above the top of myElem. Use to add a buffer between the element and the top of the viewport scrollTo(myElem, -30) // Scrolls to the top of the page scrollTo('top')