scroll-element-into-view

1.0.2 • Public • Published

scroll-element-into-view

Scroll an element into view with animation time and custom easing functions

Usage

var scrollElementIntoView = require('scroll-element-into-view');
scrollElementIntoView(element);

Timing and easing functions

You can pass in an animation time and an easing function that takes a value between 0 and 1 representing a percentage of the animation time left and should return a transformed value between 0 and 1.

scrollElementIntoView(element, 1500, function(value){
    return Math.pow(value, 4);
})

Defaults are set to 750ms and a linear easing function.

Package Sidebar

Install

npm i scroll-element-into-view

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • mattlarner