1

I'm using Google Maps on my page and I want to prevent clicks on any of the MarkerImages I've set up from bubbling up to the parent container of the map. Is this possible? MarkerImages, when rendered on the page, seem to be just a series of divs with inline styling and no IDs or classes - I don't think I can target them specifically in order to use e.preventDefault(); or anything like that.

daGUY
  • 27,055
  • 29
  • 75
  • 119

1 Answers1

0

There is a stop()-method for mouse-events that should stop the propagation, but for me it doesn't work.

Another approach would be

map.getDiv().onclick=function(e)
{
  if(e){e.stopPropagation();}
  else if(window.event){window.event.cancelBubble=true;}  
}

...this should stop the propagation of clicks to outside of the map.

Dr.Molle
  • 116,463
  • 16
  • 195
  • 201