微信公众号网页长按屏蔽默认事件后点击动态加载的数据仍可以触发事件
var t,t1=0; var pointer = document.querySelector('.uplist li'); var cancelTimeout = function() { if(t) { clearTimeout(t); t = null; } }; $('body').on('touchstart','.uplist li',function(e){ //开始点击时 var obj = $(this).attr('class'); var id = $(this).attr('data-id'); t = setTimeout(function() { console.log(obj); inputc(obj,id); cancelTimeout(); t1 = t1+1; console.log("hhhd "+t1); }, 900); e.preventDefault(); console.log(" tt "+t+"t1 "+t1); return false; }) $('body').on('touchend','.uplist li',function(){ //松开时 var id = $(this).attr('data-id'); console.log(" tt "+t+"t1 "+t1); if(t1!=1){ //执行事件 //window.location.href = 'Upinfo.html?id='+id; } t1 = 0; cancelTimeout(); }) $('body').on('touchcancel','.uplist li',function(){ console.log(" ttt "+t); cancelTimeout(); });