A detailed description of the touch event on the mobile side

Source: Internet
Author: User
This article brings you the content of the mobile side of the touch event, there is a certain reference value, the need for friends can refer to, I hope to help you.

1.touchstart

Triggers when the finger touches the screen

Dom.addeventlistener (' Touchstart ', function (e) {}); startx=e.touches[0].clientx;

The object returned by the event e contains properties specific to the mobile side:
Tarchtouches: All current touches of the target element
Changedtouches: All touch of the latest change on the page
Touches: All the touches on the page

2.touchmove

Continuous trigger when finger is sliding on screen

Dom.addeventlistener (' Touchmove ', function (e) {});

The object returned by the event e contains properties specific to the mobile side:
Tarchtouches: All current touches of the target element
Changedtouches: All touch of the latest change on the page
Touches: All the touches on the page

3.touchend

Triggered when the finger leaves the screen

Dom.addeventlistener (' Touchend ', Funciton (e) {});//In Touchend, touches can't get touch object,//Because touch is over, Changedtouches gets touch object Console.log (e);//endx=e.touches[0];  Undefined endx=e.changedtouches[0].clientx;

The object returned by the event e contains properties specific to the mobile side:
Changedtouches: All touch of the latest change on the page
Touchcancel: Triggered when the system stops tracking touch. (not used frequently)
In the event of Touchend, events will be recorded Changetouches

4. E.touches[0]

ClientX: Touch the x-coordinate of the target in the viewport.
ClientY: Touch the y-coordinate of the target in the viewport.
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.

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.