【发布时间】:2016-09-01 09:24:38
【问题描述】:
这是我的代码,
<body>
<div id="first" style="background-color:red;height:90px;width:200px;">
</div>
<div id="second" style="background-color:blue;height:90px;width:200px;">
</div>
<script>
var ele1 = document.getElementById("first"), ele2 = document.getElementById("second");
$("#first").css('touch-action', 'none');
$("#second").css('touch-action', 'none');
$(ele1).bind("touchend mouseup", function (e) {
alert("red");
});
$(ele2).bind("touchend mouseup", function (e) {
alert("blue");
})
</script>
</body>
如果我单击(使用鼠标)红色元素并拖动到蓝色元素,它会将警报框显示为蓝色......它工作正常。 在这种情况下,mouseup 事件是从正确的蓝色触发的
但是当我触摸红色并拖动到蓝色元素时,它会将警报框抛出为红色......在这种情况下,touchend 事件是从红色元素触发的......如何解决它?这是在chrome浏览器中复制的。
【问题讨论】:
标签: javascript jquery google-chrome events touch