scroll
animates the scroll top/left position of an element (in 340 bytes)
note: you may need to polyfill requestAnimationFrame
in older browsers
install
npm install scroll
use
var scroll = var page = var ease = // Basic usagescrollleftpage 200 // Register a callbackscrolltoppage 200 { console // { message: "Scroll cancelled" } or // { message: "Element already at target scroll position" } or // null console // => The new scrollTop position of the element // This is always returned, even when there’s an `err`.} // Specify a custom easing functionscrollleftpage 200 ease: easeinBounce // Specify a duration in milliseconds (default: 350) and register a callback.scrollleftpage 200 duration: 1000 {} // Cancel a scroll animationvar options = duration: 1000 var cancel = scrolltoppage 200 options { console // => Scroll cancelled page} page
note: the default easing is inOutSine
from component/ease.