How to use jQuery touch events plugin for mobiles ?
Please download the required pre-compiled file from the link and save it in your working folder for implementation.
Use the following link in the head section of your HTML web page
Example 1: The following code demonstrates the simple tap event by the user using the jQuery Touch Event plugin.
- Before touch event:
- After touch event: After the “Touch Me!” is tapped once, the following output is shown.
Example 2: The following code demonstrates the single tap as well as the double tap events by the user using double chaining of functions as shown below.
Output: After the “Touch Me!” is tapped twice, the following output is shown.
Example 3: The following code demonstrates the tap start and tap end touch events when the user taps on the HTML controls.
Output: When the user taps the “Touch Me!” div, the following output is shown.
Example 4:The following code demonstrates the swipe event and swipe end events when the user swipes on the HTML control.
Output: When the user swipes the text on “Touch Me!” div, the following output is shown.
There are many more touch events handler functions along with data thresholds and utility functions available in the plugin. The developer can make use of them as per the application’s need.
Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML course.