Simple plugin for scroll smoothly.
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>
var scroller = animateScrollTo(target[, options][, callback]);
- a number with vertical offset in px
50
. - a string with relative step:
+=50
,-=50
. - a string with shorthand
top | bottom
.
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.
start
pause
resume
isPaused
- [] autoStart
- [] change speed
MIT