Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 471 Bytes

File metadata and controls

28 lines (20 loc) · 471 Bytes

Swipe Events helper

Init sample

const el = document.querySelector('.el')
const swipeEvents = new SwipeEvents(el)

function prev () {
  console.log('prev')
}

function next () {
  console.log('next')
}

el.addEventListener('swipeRight', prev)
el.addEventListener('swipeLeft', next)

Destroy sample

el.removeEventListener('swipeRight', this.prev)
el.removeEventListener('swipeLeft', this.next)
swipeEvents.removeEventListener()