2.2.0 • Published 3 years ago

ease-scroll-to v2.2.0

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

ease-scroll-to

Install

pnpm add ease-scroll-to

Quick Start

javascript

import easeScrollTo from "ease-scroll-to"

window.onclick = () => {
  easeScrollTo().then(options => {
    console.log(options)
  })
}

typescript

import easeScrollTo from "ease-scroll-to"

const app = document.getElementById('app')
window.onclick = () => {
  easeScrollTo({
    target: app!,
    top: 0,
    duration: 300,
    type: 'ease',
  }).then(options => {
    console.log(options)
  })
}

Options

This function accepts a param which is default 0 and return a Promise which returns the options when resolved.

If the param is a number, it will assign to options.top.

Otherwise, the param should be an object and will assign to options.

The default options is:

const options = {
  top: 0, // The target scrollTop(px).
  duration: 300, // The animation duration(ms).
  target: window, // The scroll container, you can pass a HTMLElement.
  type: 'ease' // Types: ease, linear
}
2.2.0

3 years ago

2.1.1

4 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago