0

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?

Acidnuk
  • 73
  • 1
  • 10
  • possible duplicate of [Detect double tap on ipad or iphone screen using javascript](http://stackoverflow.com/questions/8825144/detect-double-tap-on-ipad-or-iphone-screen-using-javascript) – 23tux Jun 11 '15 at 10:27
  • I have no problem running the event double tap on ipad. It works great with hammer. On desktop dblclick and DoubleTap are both triggered. – Acidnuk Jun 11 '15 at 13:20
  • 1
    You can remove `dblclick` and leave only `doubletap` that will be triggered both on mobile and desktop, AFAIK – Maxim Mazurok May 28 '20 at 06:28

1 Answers1

0

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"

Community
  • 1
  • 1
Acidnuk
  • 73
  • 1
  • 10