page-scroll
v0.6.2
Published
a no-dependency function that page scroll smoothly
Downloads
871
Readme
pageScroll
a no-dependency function that page scroll smoothly
demos
Usage
with NPM
$ npm install --save page-scroll
then
import pageScroll from 'page-scroll';
As a Standalone lib
Copy page-scroll.js from /dist/page-scroll.js and place it in your project.
<script src="./js/page-scroll.js"></script>
Applying effects
<button onclick="pageScroll( 500 )">to 500px</button>
<button onclick="pageScroll( document.querySelector( '.target' ) )">to the element</button>
options
pageScroll
takes options in second argument.
pageScroll( 500, {
duration: 500,
easing: 'easeOutExpo',
disableInterrupt: true,
} ).then( () => console.log( 'done' ), () => console.log( 'canceled' ) );
for overflow elements
pageScroll( 500, {
el: document.querySelector( '.overflowScrollElement' ),
duration: 500,
easing: 'easeOutExpo',
disableInterrupt: true,
} );