模拟app 长按后触发事件$.fn.longPress = function(fn) { var timeout = undefined; var $this = this; for(var i = 0;i<$this.length;i++){
$this[i].addEventListener('touchstart', function(event) {
timeout = setTimeout(fn, 800);
}, false);
$this[i].addEventListener('touchend', function(event) {
clearTimeout(timeout);
}, false);
}
};
//cmt01动态添加的元素
$('.cmt01').each(function(e){ //var _this = $(this);
$(this).longPress(function(){
alert(1)
});
})
添加回答
举报
0/150
提交
取消