我可以检查是否像这样触发了mousedown:
$(something).on("mousemove touchmove", function(e) {
if (e.buttons == 1){
// mouse is down
}
})非常简单的问题,我如何检查touchstart是否在上面被触发?我试过:
if (e.type === 'touchstart'){
// touchstart has been triggered
}这一点现在已经完全奏效了。有人能给我指点一下我如何做到这一点吗?
发布于 2016-11-28 08:31:06
检查if属性的e.type语句是要使用的正确逻辑。但是,您的条件失败了,因为您连接到了mousemove和touchmove,而不是touchstart。
您需要在事件列表中包括touchstart:
$(something).on("mousemove touchmove touchstart", fn);或者检查type属性中的touchmove,如果这是您的意图:
if (e.type === 'touchmove'){
// touchmove has been triggered
}https://stackoverflow.com/questions/40839927
复制相似问题