An open API service indexing awesome lists of open source software.

https://github.com/bendrucker/smooth-move

Smoothly scroll a scrollable element
https://github.com/bendrucker/smooth-move

Last synced: over 1 year ago
JSON representation

Smoothly scroll a scrollable element

Awesome Lists containing this project

README

          

# smooth-move [![Build Status](https://travis-ci.org/bendrucker/smooth-move.svg?branch=master)](https://travis-ci.org/bendrucker/smooth-move) [![Greenkeeper badge](https://badges.greenkeeper.io/bendrucker/smooth-move.svg)](https://greenkeeper.io/)

> Smoothly scroll a scrollable element

## Install

```
$ npm install --save smooth-move
```

## Usage

```js
var scroll = require('smooth-move')

scroll(element, {
x: 0,
y: 20
})
//=> scrolls the element down `y` pixels
```

## API

#### `scroll(element, options)` -> `undefined`

##### element

*Required*
Type: `HTMLElement`

A scrollable element.

##### options

###### x / y

*Required*
Type: `number`

Distance to scroll along the x/y axes.

###### ease

Type: `array[number]`
Default: `[0.25, 0.1, 0.25, 1]'`

[Cubic bezier points](http://cubic-bezier.com)

###### duration

Type: `number`
Default: `1000`

The duration of the animation

![Smooth move Ferguson](http://media.tumblr.com/tumblr_lkh26ovh9i1qfy7a6.jpg)

## License

MIT © [Ben Drucker](http://bendrucker.me)