关于zepto.js 绑定tap事件会执行两次的解决方法
最近做了个碰到了用zepto 绑定tap事件 执行两次
本人使用 通过定时器 来解决 代码如下:
$(function(){ var temp=0; $('.xx').bind('tap',function(){ temp++; if(temp==1){ setTimeout(function(){ xx();////此处你执行的方法 temp=0; },100) } }) })
最近做了个碰到了用zepto 绑定tap事件 执行两次
本人使用 通过定时器 来解决 代码如下:
$(function(){ var temp=0; $('.xx').bind('tap',function(){ temp++; if(temp==1){ setTimeout(function(){ xx();////此处你执行的方法 temp=0; },100) } }) })