@f/scroll-to

0.2.0 • Public • Published

scroll-to

Build status Git tag NPM version Code style

Imperatively smooth scroll to the given y-coordinates.

Preview

Installation

$ npm install @f/scroll-to

Usage

var scrollTo = require('@f/scroll-to')

// scroll to y-coordinates `100` with a duration of `500` and a
// custom easing function
scrollTo(100, 500, easeOutQuint)

Example

To run the example showed in the gif above, run:

$ npm i && npm run example

API

scrollTo(y, duration, easing, offset)

  • y - Position to move to.
  • duration - Duration of the scrolling animation.
  • easing - Custom easing function. Defaults to a linear function (t => t).
  • offset - Scroll offset position. Defaults to window.scrollY.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @f/scroll-to

Weekly Downloads

1

Version

0.2.0

License

MIT

Last publish

Collaborators

  • f