Skip to content

yurayarosh/swipelistener-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swipelistener-js

Small JS plugin to handle swipe gestures.

Install

$ yarn add swipelistener-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

{
  moveCallbacks: false,
  resistance: 0,
}

Methods

swipe.on(eventName, callback)
swipe.off(eventName, callback)
swipe.destroy() 

Events names

  • swipeup
  • swipedown
  • swipeleft
  • swiperight
  • moveup
  • movedown
  • moveleft
  • moveright