About the Click event on the mobile side

Source: Internet
Author: User

Execution of the Click event on the mobile side usually has a delay of 300 milliseconds, and to prevent this unwanted delay, we can do it in a different way, as well as the effect of the click event quickly.

Let's look at the execution order of the mobile click: Touchstart-> Touchmove, Touchend, MouseOver->mousemove->click, as you can see from this execution order, walk through this Process, 300 milliseconds to the click Response is not surprising.

In this case, we can completely replace the Click event with Touchstart, and in the Click event, the type of event can be used to quickly execute the response.

iOS blocks the default click event principle, which requires the main:

(1) only for iOS, other platforms do not have to block;

(2) When touchend to see the movement of the finger to feel that the click or cancel the touch event;

(3) It is necessary to block only if the event type is click.

Compare time and position with Touchstart when Touchend, to distinguish whether "pressed" operation is performed. It is worth mentioning that the tap event of Zepto has been a good solution to this problem for us.

About the Click event on the mobile side

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.