Luke Dennis Luke Dennis - 1 year ago 92
jQuery Question

What's the best way to handle longtap and double-tap events on mobile devices using jQuery?

I'm looking for the best solution to adding both "doubletap" and "longtap" events for use with jQuery's live(), bind() and trigger(). I rolled my own quick solution, but it's a little buggy. Does anyone have plugins they would recommend, or implentations of their own they'd like to share?

Answer Source

It has been reported to jQuery as a bug, but as doubletapping isn't the same as doubleclicking, it does not have a high priority. However, mastermind Raul Sanchez coded a jquery solution for doubletap which you can probably use! Here's the link, works on mobile Safari.

It's easy to use:

$('selector').doubletap(function() {});


And there's a longtap plugin here! You can see a demo on your iPad or iPhone here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download