你可以查一下代码here。我尝试过全球和本地活动
event.preventDefault()
event.stopPropagation()
event.returnValue = false
event.cancelBubble = true;
上面的代码对于鼠标单击事件工作正常,但对于触摸事件映射仍然接收单击事件。
您可以添加一个监听器touchend
事件,因此您可以停止该事件的传播:
google.maps.event.addDomListener(div, "click", function(e) {
console.log("over click");
e.preventDefault();
e.stopPropagation();
clickOverlay();
})
google.maps.event.addDomListener(div, "touchend", function(e) {
console.log("over touchend");
e.preventDefault();
e.stopPropagation();
clickOverlay();
})
这是您的小提琴更新:https://jsfiddle.net/beaver71/xx1ycd7L/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)