I am trying to detect a pinch event using Hammer.js and a touch emulator in Chrome on the desktop. It can detect panning and not touch problems, but the pinch does not seem to respond. Change code code to codepen here:
http://codepen.io/anon/pen/NqWymK
In case you are not familiar with the touch emulator, the pinch event should be modeled by holding down the shift key and clicking with the mouse.
(HTML)
<script src="http://cdn.rawgit.com/hammerjs/touchemulator/master/touch-emulator.js"></script>
<script>
TouchEmulator();
</script>
<script src="https://hammerjs.imtqy.com/dist/hammer.js"></script>
<div id="myElement"></div>
(CSS)
#myElement {
background: silver;
height: 300px;
text-align: center;
font: 30px/300px Helvetica, Arial, sans-serif;
}
(Js)
var myElement = document.getElementById('myElement');
var mc = new Hammer(myElement);
mc.on("pinch pan tap", function(ev) {
myElement.textContent = ev.type +" gesture detected.";
});
Any ideas?
thank
source
share