JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://gelform.com/testyourscreen.com/jgestures.min.js"></script>
<div class="square">1</div>
<div class="square">2</div>
<div class="square">3</div>
<div class="square">4</div>
<div class="square">1</div>
<div class="square">2</div>
<div class="square">3</div>
<div class="square">4</div>
<div class="square">1</div>
<div class="square">2</div>
<div class="square">3</div>
<div class="square">4</div>
<div class="square">1</div>
<div class="square">2</div>
<div class="square">3</div>
<div class="square">4</div>
<div id="console">
</div>
CSS
* {font-family: sans-serif; margin: 0; padding: 0;}
html, body {height: 100%;}
.square { background: green; float: left; height: 25%; width: 25%;}
.touch {background: red;}
#console {background: #FFF; bottom: 0; float: right; font-size: 1.618em; position: fixed; right: 0;}
JavaScript
function touchHandler(event)
{
var touches = event.changedTouches,
first = touches[0],
type = "";
switch(event.type)
{
case "touchstart": type = "mousedown"; break;
case "touchmove": type="mousemove"; break;
case "touchend": type="mouseup"; break;
default: return;
}
//initMouseEvent(type, canBubble, cancelable, view, clickCount,
// screenX, screenY, clientX, clientY, ctrlKey,
// altKey, shiftKey, metaKey, button, relatedTarget);
var simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent(type, true, true, window, 1,
first.screenX, first.screenY,
first.clientX, first.clientY, false,
false, false, false, 0/*left*/, null);
first.target.dispatchEvent(simulatedEvent);
event.preventDefault();
}
$(document).ready(function(){
document.addEventListener("touchstart", touchHandler, true);
document.addEventListener("touchmove", touchHandler, true);
document.addEventListener("touchend", touchHandler, true);
document.addEventListener("touchcancel", touchHandler, true);
$('.square').bind('swipeone mouseover mousedown mousemove', function(e){
$(this).addClass('touch');
$('<div class="log">' + e.type + '</div>').appendTo('#console');
});
});