page-scroll

a no-dependency function that page scroll smoothly

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
page-scroll
0.6.14 months ago7 years agoMinified + gzip package size for page-scroll in KB

Readme

pageScroll
a no-dependency function that page scroll smoothly
Latest NPM release MIT License

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,
} );