Tutorial: Tap vs swipe

Tap vs swipe

touchSwipe Fork me on GitHub

events: tap, doubleTap, longTap, swipe

properties: longTapThreshold, doubleTapThreshold

You can also detect if the user simply taps and does not swipe with the tap handler

The tap, doubleTap and longTap handler are passed the original event object and the target that was clicked.

See also the hold event for when a long tap reaches the longTapThreshold

If you use the jquery.ui.ipad.js plugin (http://code.google.com/p/jquery-ui-for-ipad-and-iphone/) you can then also pickup standard jQuery mouse events on children of the touchSwipe object.

You can set the delay between taps which defines a double tap, and the length of a long tap with the doubleTapThreshold and longTapThreshold properties.

Note: If you assign both tap and double tap, you tap events will be delayed by the length of doubleTapThreshold as it waits to see if its a double before trigger the event

tap replaces the old click handler for naming consistency. Since the introduction of event triggering as well as callbacks, the plugin cannot trigger a click event as it clashes with the jQ click event, so both the event and callback are called tap. For backwards compatibility, the click callback will still work but there is no click event. You must use the tap event when binding with on or bind


			

			
Swipe, Tap, Double Tap or Long Tap me

Open Google

Im just a child div

Im a child div with my own jQuery click handler