page-scroll
TypeScript icon, indicating that this package has built-in type declarations

0.6.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i page-scroll

Weekly Downloads

108

Version

0.6.2

License

MIT

Unpacked Size

20 kB

Total Files

9

Last publish

Collaborators

  • yomotsu