Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

13. Hooking into Events > Touch Events

Touch Events

There are many touch events you can hook into with jQuery Mobile. Keep in mind that these are available only to touch-enabled devices, so desktop users may not experience them or any customizations added via an event hook. With that said, touch events won’t cause errors on desktop devices: they simply won’t function, because mouse events rule the desktop experience. These events can trigger a callback function that includes any custom JavaScript. Table 13.1 describes the five different touch events accessible through the jQuery Mobile API.

Table 13.1. Touch events

Image

Table 13.2 describes the swipe event properties mentioned in Table 13.1.

Table 13.2. swipe event properties

Image

To bind to any of these touch events, you must use the document.ready event. Once the document is ready, you can access an HTML element and bind your selected touch event:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint