Scroll-Animate-To

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()

            

Usage


                      import ScrollTo from 'scroll-animate-to'
  let element = document.getElementById('element')
  let s = new ScrollTo({ target: element })
  s.scroll()

                

API


Please see on Github.

Install


                        npm i scroll-animate-to
                    

Or use script tag directly.new window.ScrollTo get an instance.