[英]Am i using fastclick.js correctly?
I want to see if i am using fastclick.js right. 我想看看我是否正在使用fastclick.js。 I can't really tell if its faster or not.
我真的不知道它是否更快。 Here is my code:
这是我的代码:
<script type='application/javascript' src='fastclick.js'></script>
<script type="application/javascript">
window.addEventListener('load', function() {
new FastClick(document.body);
}, false);
</script>
Yes. 是。
The official sample: ( https://github.com/ftlabs/fastclick ) 官方示例:( https://github.com/ftlabs/fastclick )
window.addEventListener('load', function() {
FastClick.attach(document.body);
}, false);
Is just a synonym for what you do. 只是您所做工作的同义词。 As the actual code states that:
如实际代码所示:
FastClick.attach = function(layer, options) {
'use strict';
return new FastClick(layer, options);
};
Anyway, you might want to consider carefully if FastClick is the suitable solution for you... It has a giant performance problem, because of the way it behaves (Computing hit tests. On large doms - that's an overkill) 无论如何,您可能需要仔细考虑FastClick是否是适合您的解决方案...由于它的行为方式,它存在一个巨大的性能问题(计算命中测试。在较大的Dom上,这太过分了)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.