I'm using Google Maps on my page and I want to prevent clicks on any of the MarkerImage
s I've set up from bubbling up to the parent container of the map. Is this possible? MarkerImage
s, when rendered on the page, seem to be just a series of div
s 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.
Asked
Active
Viewed 194 times
1

daGUY
- 27,055
- 29
- 75
- 119
1 Answers
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