animate-scroll-to.js

0.1.5 • Public • Published

animate-scroll-to

Simple plugin for scroll smoothly.

Installation and use

install with npm

npm install animate-scroll-to.js

Common.js

var animateScrollTo = require('animate-scroll-to.js');

or add it to your page

<script src="dist/animate-scroll-to.js"></script>

<!-- or minified version -->
<script src="dist/animate-scroll-to.min.js"></script>

API

var scroller = animateScrollTo(target[, options][, callback]);

target

  • a number with vertical offset in px 50.
  • a string with relative step: +=50, -=50.
  • a string with shorthand top | bottom.

options

  • duration: Number - duration of the animation (default: 468).
  • animate: Boolean - whether the scrolling should animate smoothly (default: true).
  • speed: Number - px per second (px/s) of animation.

NOTE: if speed specifies duration will be ignored.

scroller

  • start
  • pause
  • resume
  • isPaused

TODO

  • [] autoStart
  • [] change speed

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i animate-scroll-to.js

Weekly Downloads

6

Version

0.1.5

License

MIT

Unpacked Size

41.9 kB

Total Files

8

Last publish

Collaborators

  • takumiao13