Skip to content

liimonx/TouchEvent

Repository files navigation

touchevent.js

TouchEvent is just a simple Script that will allow supporting touch event on all devices.

Demo: https://liimonx.github.io/TouchEvent/

Installation

npm

npm i TouchEvent.js

Now add it to your project:

Webpack

  import TouchEvent from 'TouchEvent'

HTML

  <script src="./TouchEvent/dist/TouchEvent.js"></script>

Usage

  new TouchEvent('.name_of_element', (event) => {
    console.log(event.startX)
    console.log(event.startY)
    console.log(event.endX)
    console.log(event.endY)
    console.log(event.walkX)
    console.log(event.walkY)
    console.log(event..target)
  })

Licence

TouchEvent.js is under MIT licence