转载:https://blog.csdn.net/qq_39831708/article/details/82792134
$("#target").on({
touchstart: function(e) {
// 长按事件触发
timeOutEvent = setTimeout(function() {
timeOutEvent = 0;
alert('你长按了');
}, 400);
//长按400毫秒
// e.preventDefault();
},
touchmove: function() {
// 部分安卓设备,长按时会不停触发touchmove事件,这里不做处理
},
touchend: function() {
clearTimeout(timeOutEvent);
if (timeOutEvent != 0) {
// 点击事件
// location.href = '/a/live-rooms.html';
alert('你点击了');
}
return false;
}
})