22 July 2010

A quick note on using "tap" with jQTouch

As David Kaneda explains in the jQTouch blog, he introduced a tap custom event to remove a 300ms delay when tapping on a link in Mobile Safari.

On other browser platforms, a tap event will be interpreted as a click, so I can use it when I want to respond to both types of events in different browsers.

However, tap is intended for use with links, i.e. with an anchor tag (<a href...). It will not respond appropriately to a tap on a part of the screen that is not a link. In that case I should use click instead. this will work whatever platform I am using—as long as I am not clicking on a link.

So, to get the desired cross-platform behaviour for mobile apps, use the tap event for links and click otherwise.

d. sofer