I want to see if i am using fastclick.js right. 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 )
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.