Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/gesture
Multi-touch gesture sugar layer on top of hammer.js
https://github.com/component/gesture
Last synced: 12 days ago
JSON representation
Multi-touch gesture sugar layer on top of hammer.js
- Host: GitHub
- URL: https://github.com/component/gesture
- Owner: component
- Created: 2012-08-15T18:27:46.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-01-06T23:17:07.000Z (almost 8 years ago)
- Last Synced: 2024-05-08T17:11:04.795Z (8 months ago)
- Language: JavaScript
- Size: 128 KB
- Stars: 16
- Watchers: 2
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# Gesture
Emitter wrapper and a little sugar on top of [Hammer.js](https://github.com/eightmedia/hammer.js).
## Installation
```
$ component install component/gesture
```## Events
- `drag start`
- `drag`
- `drag end`
- `tap`
- `double tap`
- `hold`
- `release`
- `transform start`
- `transform`
- `transform end`
- `swipe`
- `swipe left`
- `swipe right`
- `swipe up`
- `swipe down`## API
### gesture(el)Bind gestures to the given `el` and returns a `Gesture`.
```js
var gesture = require('gesture');
var img = document.getElementById('maru');var maru = gesture(img);
maru.on('transform', function(e){
var r = e.rotation.toFixed(2);
var s = e.scale.toFixed(2);
img.style['-webkit-transform'] = 'rotate(' + r + 'deg) scale(' + s + ')';
});setTimeout(function(){
maru.unbind();
}, 5000);
```### Gesture#unbind()
Unbind event handlers.
## License
MIT