Fastclick.js What's the use?
To speed up the speed of the phone, testing is available, soon ... js of Fastclick
Fastclick is a simple, easy-to-use JS library used to eliminate the 300 delay between triggering the Click event on a mobile browser and a physical tap (tap). It supports the following browsers:
Mobile Safari on IOS 3 and upwards
Chrome on IOS 5 and upwards
Chrome on Android (ICS)
Opera Mobile 11.5 and upwards
Android Browser since honeycomb
PlayBook OS 1 and upwards
For non-mobile browsers, disable the zoom label.
<meta name= "viewport" content= "initial-scale=1.0, User-scalable=no" >
Introducing Files
<script type= ' application/javascript ' src= '/path/to/fastclick.js ' ></script>
Nima use is too simple, a straight sentence:
Fastclick.attach (document.body);
So all the click response speed directly increased, just! What input gets the focus of the problem also solved!!! If you really can, the original change page colleague Will chew me
=================================================
http://www.zhihu.com/question/20702822
On the Handheld browser (this is primarily the browser of the WebKit kernel on iOS and Android systems and the WebView embedded in the application),
Since two consecutive "taps" are "magnified" operations (even if you touch a link or an element with the Click event Listener two times),
So after the first "touch", the browser needs to wait a while to see if there is a "continuous second touch"
。 If so, make a "zoom in" operation. No, it is safe to think that the user is not to zoom in, but need "click" to now dare to trigger the Click event,
The Click event that causes "short press (finger touch screen to leave screen less time)" is usually about 300ms of appointment delay.
Using Touchstart instead of Click is a relatively elementary solution, first of all, Touchstart and click Trigger conditions are different, for handheld devices browser:
1.touchstart: In this dom (or bubbling to this DOM, This is of course nonsense) on the finger touch start can trigger
2.click: In this dom (or bubbling to this DOM, which is of course nonsense) on the finger touch started, and the finger never moved on the screen (some browsers allow moving a very small displacement value), And when the finger leaves the screen on this DOM, and the time between touch and leave screen is short (some browsers do not detect the interval, it also triggers click) to trigger
so we can see that it is not advisable to use Touchstart instead.
According to the above differences, but also to circumvent the click on the mobile handheld device delay, it is easy to have a simulation approach, the general idea is:
in Touchstart, touchend when recording time, finger position, in the touchend when compared, If the position of the finger is the same position (or allows a very small displacement value to be moved) and the time interval is short (generally considered to be 200ms) and the touchmove has not been triggered in the process, it can be assumed that the "click" on the handheld device is triggered, which is generally referred to as "tap"
Zepto has encapsulated the above tap:zepto/src/touch.js at Master Road, Madrobby/zepto Road, GitHub
In addition (by the following @ Zhang Zhen classmate's answer,) can also be used directly fastclick:ftlabs/ Fastclick GitHub to simulate clicks, there will be no delay, and I have migrated to this scenario at the moment.
Update:
- Zepto There are some minor problems with the previous implementation, and in some cases it can lead to a point (HTTP//blog.youyo.name/archives/ zepto-tap-click-through-research.html), now the latest version of the issue has been fixed.
- On Android 4.1+ Chrome Browser, if you specify that the page is not scalable in Meta viewport, click does not have a delay of about 300MS
JS plugin fastclick.js Address phone-side click Delay