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
- Host: GitHub
- URL: https://github.com/bendrucker/smooth-move
- Owner: bendrucker
- License: mit
- Created: 2015-08-23T23:15:54.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2019-08-19T21:49:51.000Z (almost 7 years ago)
- Last Synced: 2025-04-15T00:03:42.366Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# smooth-move [](https://travis-ci.org/bendrucker/smooth-move) [](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

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