A light Javascript library to scroll in x as well as y axis.
var pageTwo = document.getElementById('page-two')
var pageTwoInner = document.getElementById('page-two-inner')
var e2 = document.getElementById('e2')
var one = new ScrollTo({
target: pageTwo,
duration: 1200
})
var two = new ScrollTo({
container: pageTwoInner,
target: e2,
axis: 'x',
animationFn: 'easeOut',
callback: function(){
console.log('ok')
}
})
one.scroll()
two.scroll()
import ScrollTo from 'scroll-animate-to'
let element = document.getElementById('element')
let s = new ScrollTo({ target: element })
s.scroll()
Please see on Github.
npm i scroll-animate-to
Or use script tag directly.new window.ScrollTo get an instance.