How to stopPropagation of touch event on overlay GoogleMap

前端 未结 1 1954
隐瞒了意图╮
隐瞒了意图╮ 2021-01-22 03:53

You can find out code here. I tried with global & local event both

event.preventDefault()
event.stopPropagation()
event.returnValue = false
event.cancelBubbl         


        
相关标签:
1条回答
  • 2021-01-22 04:05

    You can add a listener to touchend event, so you can stop the propagation of this event:

      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();
      })
    

    Here is your fiddle updated: https://jsfiddle.net/beaver71/xx1ycd7L/

    0 讨论(0)
提交回复
热议问题