function touchends(ele,callback){
flag = 1;
if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){
$(document).on('touchstart',ele,function(e){
e.preventDefault();
flag = 1;
})
//滑动触屏
$(document).on('touchmove',ele,function(e){
flag = 0;
})
//触屏结束
$(document).on('touchend',ele,function (t){
if(flag === 1){
callback($(this),t)
// document.ontouchstart=function(){
// return false;
// }
// t.preventDefault();
flag = 1;
}
});
}else{
$(document).on('click',ele,function (t){
callback($(this),t) //触发的事件
});
}
}
移动端区分点击和轻微滑动
最新推荐文章于 2023-03-27 22:29:02 发布