scroll
A function that animates an element’s scrollTop or scrollLeft position.
Install
npm install scroll
Usage
var scroll = require('scroll')
var page = require('scroll-doc')()
scroll.left(page, 200)
scroll.top(page, 200, function (error, scrollTop) {
console.log(error)
console.log(scrollTop)
})
scroll.left(page, 200, { ease: 'inBounce' })
scroll.left(page, 200, { duration: 1000 }, function (error, scrollLeft) {
})
var options = { ease: 'inBounce', duration: 1000 }
var cancel = scroll.top(page, 200, options, function (error, scrollTop) {
console.log(error.message)
page.removeEventListener('wheel', cancel)
})
page.addEventListener('wheel', cancel)
Note: The easing functions are those specified in component/ease.
License
MIT