Mobile Touch Dianchuan (penetrating) solution

Source: Internet
Author: User
Answer a

Penetration (Dianchuan) is a common bug that occurs in various browsers on mobile. This may be caused by a delay in the Click event or by event bubbling.

Touch and tap events in common Zepto libraries for mobile Web development are a bit of a bug (Zepto events are tied to document).

Solution Solutions

1, using Fastclick, this can be very perfect to solve the Dianchuan problem.

2. Add Preventdefault to the Touchend event callback and add Pointer-events:none to the next layer.

Answer two

The click on the mobile side is the touch before the trigger is simulated.

The order of the triggers is

Touchstart

Touchmove

Touchend

MouseDown

MouseMove

MouseEnter

Click

In overlapping areas, the masked element binds the click, the masked element binds the touch event, and the touch-masked element is hidden, resulting in penetration, because the click is delayed after touch, and the browser mistakenly considers the click to be triggered on the masked element.

The best solution is to simulate a click event yourself through Touchstart,touchmove,touchend, so that the event will respond more quickly in addition to preventing penetration.

Mobile Touch Dianchuan (penetrating) solution

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.