Using the Click event on the mobile side produces a 300ms delay
The problem arises:
Mobile has double-click to enlarge the problem, so when the mobile click event occurs, in order to determine the user's behavior (in the end to double-click or to click), the browser will usually wait for 300ms, if the user does not click again within 300ms, it is decided to click the event, otherwise decided to double-click Zoom.
Why to solve:
The extreme pursuit of performance by the online web, and the high standard of user experience, make the 300ms lag more difficult to accept
How to resolve:
1, User-scalable:no prohibit scaling--no scaling there is no double click, there is no click Delay
2, pointer event: Css:-ms-touch-action:none After clicking the browser does not enable the zoom operation, there is no delay. However, this approach is not very compatible.
3. Fastclick Library: A lightweight library developed for this issue. Fastclick after detecting the Touchend event, a simulated click event is immediately triggered and the true click event is blocked after 300ms
Usage:
1 window.addeventlistener ("load",function() {2Fastclick.attach ( document.body); 3 }); 4 // while binding to a more specific element, binding to the body can benefit the entire application .
When Fastclick detects that a user-scalable:no or Touch-action:none scheme is used in the page, it exits silently. Great!
Mobile-click event delay