Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (33 sloc) 1.5 KB


Mouse event to touch event mapping for testing touch interfaces with desktop browsers. This means that touchstart, touchmove, and touchend are hooked up to mousedown, mousemove, and mouseend, respectively. This is generally recommended for testing purposes.

Inspired by Phantom Limb (, but seeking less bloat (no graphics) and more conformance to the properties of actual touch objects.

Live Demo

Try it in your desktop browser!


Hook me up!

You hook up events just like you would on a device (libraries will use the same methods):

document.addEventListener('touchstart', function(e){}, false);
document.addEventListener('touchmove', function(e){}, false);
document.addEventListener('touchend', function(e){}, false);

Interacting with the touch events

The main difference with touch events are the touch event arrays, which Touché gladly simulates for you:

  1. touchstart has e.touches
  2. touchmove has e.touches and e.changedTouches
  3. touchend has e.changedTouches

Because a mouse cursor is representative of just one finger, these simulated arrays will only contain one element (i.e. e.touches[0]) corresponding to one touch.


document.addEventListener('touchstart', function(e){
    e.touches[0].target;   // example: "[object HTMLPreElement]"
}, false);


Tested to work on:

  • Chrome 13+
  • Safari 5.1+
  • Firefox 7+
Jump to Line
Something went wrong with that request. Please try again.