Double tap, also a double click is being triggered

2.9k views Asked by At

I simply would like to implement double tap on my double click event. the problem is doubletap overwrite double click event.

I have no problem running the event double tap on ipad. It works great with hammer. On desktop dblclick and doubletap are both triggered.

So i have to replace dblclick by doubletap ans it is not very clear to read DoubleTap and dblclick be triggered. If I put the two events, my code is executed twice. (http://jsfiddle.net/8vHjj/14/)

var output = document.getElementById("output");
var hammer = new Hammer(output);


hammer.on("doubletap", function() {
        output.innerText += " / doubletap";
    });

$("#output").on("dblclick", function(){
     output.innerText += " / doubleclick";
});

Is there a solution that would have both events?

1

There are 1 answers

0
Acidnuk On

This topic help me : Hammer.js pan event only for touch devices and not for desktop computer Click+Drag.

To trigger doubleTap only on touch device, we can use inputClass option

var hammer = Hammer(element, {
  inputClass: Hammer.SUPPORT_POINTER_EVENTS ? Hammer.PointerEventInput : Hammer.TouchInput
})

I found no API, which explain this option. The doc "hammer" does not mention the "input Class"