Frank-Shanghai / PencilCase

0 stars 0 forks source link

Fastclick #45

Closed Frank-Shanghai closed 6 years ago

Frank-Shanghai commented 6 years ago

About the akas 300ms delay issue: https://labs.ft.com/fastclick/

And the most used solution is fastclick.

Frank-Shanghai commented 6 years ago

meta setting in index.html doesn't meet the condition to apply fast click:

<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">

Source code in fastclick.js since line 748: if (chromeVersion) {

        if (deviceIsAndroid) {
            metaViewport = document.querySelector('meta[name=viewport]');

            if (metaViewport) {
                // Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)
                if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
                    return true;
                }
                // Chrome 32 and above with width=device-width or less don't need FastClick
                if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {
                    return true;
                }
            }

        // Chrome desktop doesn't need FastClick (issue #15)
        } else {
            return true;
        }
Frank-Shanghai commented 6 years ago

ToDo: Try to debug on device, check if it will meet the conditions above (first you should remove user-scalable="no").

Frank-Shanghai commented 6 years ago

https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away

从上面链接中可以看出,如果有以下设置: To remove the 300-350ms tap delay, all you need is the following in the of your page:

看来这个问题早已经不是问题了。

所以,从fastclick.js的源码中也看出,有上述设置了话,直接 return, 不做任何其他处理。 所以,目前的project中不存在fastclick issue. 恢复所有代码。