Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yurayarosh/swipelistener-js
Small JS plugin to handle swipe gestures.
https://github.com/yurayarosh/swipelistener-js
Last synced: about 1 month ago
JSON representation
Small JS plugin to handle swipe gestures.
- Host: GitHub
- URL: https://github.com/yurayarosh/swipelistener-js
- Owner: yurayarosh
- Created: 2021-09-20T14:05:14.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-10T15:46:22.000Z (about 3 years ago)
- Last Synced: 2024-10-15T08:13:14.489Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# swipelistener-js
Small JS plugin to handle swipe gestures.
### [Demo](https://yurayarosh.github.io/swipelistener-js/)
### Install
```bash
$ yarn add swipelistener-js
``````js
import Swipe from 'swipelistener-js/src/main'const swipe = new Swipe(el, options)
swipe.init()function up() {
printText('Swipe up')
}swipe
.on('swipeup', up)
.on('swipedown', () => {
printText('Swipe down')
})swipe.off('swipeup', up)
```### Options
Standart options
```js
{
moveCallbacks: false,
resistance: 0,
}
```### Methods
```js
swipe.on(eventName, callback)
swipe.off(eventName, callback)
swipe.destroy()
```### Events names
* swipeup
* swipedown
* swipeleft
* swiperight
* moveup
* movedown
* moveleft
* moveright