Mobile-Touch Events

Source: Internet
Author: User

In the mobile page development, often use touch events, such as left-sliding right-side carousel. Common touch events are touchstart , touchmovetouchend。

Each event contains the following three properties for tracking the Tiger touch:

Touches: Represents an array of touch objects that are currently tracked by touching operations.

Targettouches: An array of touch objects that are specific to the event target.

Changetouches: An array of touch objects that represent what has changed since the last touch.

Each touch event contains the following properties:

ClientX: Touch the x-coordinate of the target in the viewport.

ClientY: Touch the y-coordinate of the target in the viewport.

Identifier: Identifies the unique ID of the touch.

PageX: Touch the x-coordinate of the target in the page.

Pagey: Touch the y-coordinate of the target in the page.

ScreenX: Touch the x-coordinate of the target in the screen.

ScreenY: Touch the y-coordinate of the target in the screen.

Target: Touch the DOM node destination.

For example:

$ (document). On (' Touchstart ', function (e) {
Alert ("Start sliding (" + E.touches[0].clientx + "," + E.touches[0].clienty + ")")
});
$ (document). On (' Touchmove ', function (e) {
Alert ("Swipe in (" + E.changetouches[0].clientx + "," + E.changetouches[0].clienty + ")")
});
$ (document). On (' Touchend ', function (e) {
Alert ("Swipe end (" + E.touches[0].clientx + "," + E.touches[0].clienty + ")")
})

  

Mobile-Touch Events

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.