hammer-touchemulator
Version:
Emulate touch input on your desktop.
36 lines (27 loc) • 931 B
HTML
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="../../touch-emulator.js"></script>
<script> TouchEmulator(); </script>
</head>
<body>
<div id="hitarea" style="background: silver; height: 400px;">
Check the console. No mouseevents should be fired, only touchevents. Click events are allowed.
</div>
<script>
function log(ev) {
console.log(ev.type, ev);
}
var hitarea = document.getElementById('hitarea');
var events = ['touchstart','touchmove','touchend','touchcancel',
'mousedown','mouseenter','mouseleave','mousemove',
'mouseout','mouseover','mouseup','mousewheel',
'click'];
for(var i=0; i<events.length; i++) {
hitarea.addEventListener(events[i], log, false);
}
</script>
</body>
</html>