O'Reilly logo

jQuery Mobile Cookbook by Chetan K Jain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using touch events

The jQuery Mobile framework provides five touch events. They are the tap , taphold , swipe , swipeleft , and swiperight events. The tap event is fired when you tap the screen. If the tap duration is longer, the taphold event is fired first and then the tap event is fired after you lift your finger. When you swipe across the screen, the swipe event is fired first and then the swipeleft or swiperight events are fired, based on the direction of your swipe action. This recipe shows you how to use these touch events.

In this recipe, a yellow box is shown where you last tapped the screen. A green box is created each time you tap and hold. You can also see how the swipe action works by swiping a blue bar to the left or right edge ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required