@tianfanfan/scroll-to-with-animation
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

scroll-to-with-animation

Some plugins for vuex store.

How to use

$ npm install -S @tianfanfan/scroll-to-with-animation

Example

import scrollToTop from '@tianfanfan/scroll-to-with-animation'
// Base use
scrollToTop(0, 2000)

// animationname from https://github.com/danro/easing-js/blob/master/easing.js
scrollToTop(0, 2000, 'easeOutSine')

// FULL use
scrollToTop(0, 2000, 'easeOutSine', window, ()=>{console.log('scroll end')})

Attribute

  • smoothScrollTo(to, speed, animationName, el);
  • to : target scrollY (0 means top of the page, default 0)
  • speed : scroll speed (default 2000),more bigger meas more quick
  • animationName: + linearTween + easeInQuad + easeOutQuad + easeInOutQuad + easeInCubic + easeOutCubic + easeInOutCubic + easeInQuart + easeOutQuart + easeInOutQuart + easeInQuint + easeOutQuint + easeInOutQuint + easeInSine + easeOutSine + easeInOutSine + easeInExpo + easeOutExpo + easeInOutExpo + easeInCirc + easeOutCirc + easeInOutCirc
  • el : scroll element (default window)
  • callbackfunction: a function which will call at the end of animation

License

MIT

Package Sidebar

Install

npm i @tianfanfan/scroll-to-with-animation

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

9.16 kB

Total Files

4

Last publish

Collaborators

  • tianfanfan