Introduction to touch events and virtual mouse events in jQuery mobile page development _ jquery

Source: Internet
Author: User
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 
  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.