Skip to content

Instantly share code, notes, and snippets.

View shahmaulik's full-sized avatar

Maulik Shah shahmaulik

  • Ahmedabad,Gujarat,India
View GitHub Profile
@Alex1990
Alex1990 / mouseToTouch.js
Created October 22, 2014 14:06
Convert mouse events into touch events.
/**
* Convert mouse events into touch events.
* From: http://ross.posterous.com/2008/08/19/iphone-touch-events-in-javascript/
*/
function touchHandler(event) {
var touch = event.changedTouches[0];
var simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent({
touchstart: "mousedown",