The problem of mobile tap penetration

Source: Internet
Author: User

Scenario One: It's very direct. There's a fastclick on GitHub that can be perfectly solved Https://github.com/ftlabs/fastclick

Introduce Fastclick.js, because the Fastclick source code does not depend on other libraries, so you can add directly to the native JS before

1 Window.addeventlistener ("Load", function () {2     Fastclick.attach (document.body); 3}, False);

Or have zepto or JQM js inside add

1 $ (function () {2     Fastclick.attach (document.body); 3});

Of course, that's require:

1 var Fastclick = require (' Fastclick '); 2 Fastclick.attach (document.body, Options);

Scenario Two: Replace the tap event with Touchend and block the default behavior of Touchend preventdefault ()

1 $ ("#cbFinish"). On ("Touchend", function (event) {2     //A lot of processing such as hiding something 3     event.preventdefault (); 4});

Scenario Three: Delay a certain amount of time (300ms+) to handle the event

1 $ ("#cbFinish"). On ("Tap", function (event) {2     setTimeout () (function () {3     ///a lot of processing such as 4},320 of what is hidden     ); 5});    

The problem of mobile tap penetration

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.