1,touchstart事件触发的时候设置全局变量(名字随便取)flag = 1;
2,touchmove事件触发的时候设置 flag = 0;
3,touchend事件触发的时候判断flag值 当flag = 1 的时候触发touchend事件里面的函数,触发完以后在末尾再设置flag = 1;
//开始触屏
$(document).on('touchstart','.',function(e){
e.preventDefault();
flag = 1;
})
//滑动触屏
$(document).on('touchmove','.',function(e){
flag = 0;
})
//触屏结束
$(document).on('touchend','.',function (t){
if(flag === 1){
$(this).ImgZoomIn(); //触发的事件
document.ontouchstart=function(){
return false;
}
t.preventDefault();
flag = 1;
}
});