Search code examples
javascriptiphoneipadmobile-safari

Double tap on mobile safari


Is there a way to bind to a double-tap event (in a single line of code) for mobile safari? Or, the alternative is to implement it intercepting two single-tap events that happened in some short given time (example: http://appcropolis.com/blog/implementing-doubletap-on-iphones-and-ipads/)?


Solution

  • Short answer: you must implement via two clicks.

    Actual answer: Here is a jQuery-free implementation of double-tap for mobile safari which only requires one line of code (to enable dblclick event):

    In addition, you will likely need to disable mobile Safari's default zoom with this meta tag:

    <meta name="viewport" content="width=device-width,user-scalable=no" />