This article describes how to write touch events and virtual mouse events in jQuery mobile page development. jQuery is the most popular Javascript library and is widely used in mobile web development, for more information, see
Touch)
Some touch events in jQuery Mobile are customizable. However, these events are only available when users that interact with devices that support the touch function access your jQuery Mobile website. When these events are available, you can trigger any custom java script as a response to five different events: tap, taphold, swipe, swipeleft, and swiperight.
Tap: triggered after a complete and fast click
Taphold: triggered after a click (about one second)
Swipe: The event triggered when the horizontal drag is greater than 30PX in one second or the vertical drag is less than 20px. You can set how long it takes to drag and drop pixels. This event has its associated attributes, which are
ScrollSupressionThreshold (default: 10px)-horizontal drag is greater than this value and will not be triggered.
DurationThreshold (default: 1000 ms)-if the sliding time exceeds this value, no sliding event is generated.
HorizontalDistanceThreshold (default: 30px)-a sliding event occurs only when the horizontal moving distance exceeds this value.
VerticalDistanceThreshold (default: 75px)-a sliding event occurs only when the vertical moving distance is smaller than this value.
Swipeleft (left): triggered when the stroke event is in the left direction.
Swiperight: triggered when the stroke event is in the right direction.
To bind these events, you only need to program them in document. ready (), as shown in the following code example:
Understanding the jQuery Mobile API