Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bloodyowl/scroll
Smooth scrolling to given coordinates for the browser
https://github.com/bloodyowl/scroll
Last synced: about 2 months ago
JSON representation
Smooth scrolling to given coordinates for the browser
- Host: GitHub
- URL: https://github.com/bloodyowl/scroll
- Owner: bloodyowl
- License: mit
- Created: 2012-12-20T22:12:52.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-01-19T12:51:25.000Z (almost 8 years ago)
- Last Synced: 2024-10-19T06:09:22.918Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 169 KB
- Stars: 50
- Watchers: 4
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bloody-scroll
> Smooth scrolling to given coordinates for the browser
[![Build Status](https://travis-ci.org/bloodyowl/scroll.svg)](https://travis-ci.org/bloodyowl/scroll)
## Install
```
$ npm install --save bloody-scroll
```## Import
```javascript
import scroll from "bloody-scroll"
```## API
### promise scroll({ x: number, y: number}, duration = 300)
#### Arguments
- `coords.x` : (*Number*) Horizontal target for scroll.
- `coords.y` : (*Number*) Vertical target for scroll.
- `duration` : (*Number*) Transition duration.#### Returns
- `promise` : (*Promise*) A promise that is fulfilled once the transition is done.
### Example
```javascript
scroll({ x: 0, y: 1000 }, 1000)
scroll({ x: 1000 }, 1000)
scroll({ y: 400 }, 1000)
```