Troubleshoot latency issues with touch screen device Click event 300ms

Source: Internet
Author: User

from tapping the element on the screen to triggering the element's click event, the mobile browser (touch screen) will have a waiting time of approximately 300 milliseconds. Why is it so designed? Because it wants to see if you're going to double-click (double tap) operation. 300ms of waiting time, will make the user experience greatly impaired, Fastclick.js library is a good solution to this problem.

When using Fastclick, instantiate it on the layer you need to use. We use document.body because we want all the buttons and links to get a quick click.

How to use:

Window.addeventlistener (' Load ', function () {  Fastclick.attach (document.body);}, False);

Then using the OnClick event directly, there is no problem with the original 300ms delay.

In addition, there is a way to solve the delay problem, is to use the Zepto.js Library of tap events, but the tap event in the special case there will be a point of penetration, so it is recommended to use the Fastclick.js library.

Troubleshoot latency issues with touch screen device Click event 300ms

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.