A developper-friendly javascript touch library

CanTouchThis.js

Presentation :

Since 1990, we all want to be able to "touch this" as will. But, it can be tricky to make it real on your favorite browser. Here come canTouchThis.js, a really simple javascript library that let you handle touch events as any other event.

New events :

We all know and love javascript events, so canTouchThis.js keep the same spirit. Some new events are just triggered when needed without interfering with the old ones.

Available events :

Examples :

The code below is an example of how to detect swipe event.

element.addEventListener("swipe", function(ev){
  if(ev.detail.direction == Touch.LEFT){
    showPrevious();
  }
  else if(ev.detail.direction == Touch.RIGHT){
    showNext();
  }
};

Browser support :

The script use some new features supported only by most modern browser.