Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chemzqm/scroll
high performance scroll to component
https://github.com/chemzqm/scroll
Last synced: about 1 month ago
JSON representation
high performance scroll to component
- Host: GitHub
- URL: https://github.com/chemzqm/scroll
- Owner: chemzqm
- Created: 2014-06-04T03:46:28.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-04T04:35:57.000Z (over 10 years ago)
- Last Synced: 2024-10-29T10:44:47.850Z (2 months ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Scroll
High performance scroll to component with easy to use API.
[demo](http://chemzqm.github.io/scroll/)
## Install
component install chemzqm/scroll
## Example
``` js
var scroll = require('scroll');
var btn = document.querySelector('.btn');
var scrollable = document.querySelector('.scrollable');btn.addEventListener('touchend', function() {
scroll(scrollable, {
ease: 'linear',
duration: 1000
})
.top(100)
.left(100)
.end(function() {
})
});
```## API
### Scroll(el, [opts])
`el` is the scrollable element.
`opts` contains the options for the animation, which include:* `ease` the ease function to use, default to `out-circ`, list could be found at
* `duration` animation duration in millisecond, default `1000`.
### .top(number)
optional scrollTop in pixes.
### .left(number)
optional scrollLeft in pixes.
### .end([callback])
Optional animation callback function, must be called to start animation.