I have already subclassed my overlay object according to the google document statement, and my onAdd () function is listed below:
MyOverlay.onAdd() { var div_parent = document.createElement("DIV"); var div_child = document.createElement("DIV"); div_child.innerHTML = "Click Me"; div_parent.appendChild( div_child ); this.getPanes().overlayLayer.appendChild(div_parent); var this = that; google.maps.event.addDomListener( div_parent, 'click', function(){ google.maps.event.trigger(that, 'click');
My code may work fine ONLY in IE, but in Firefox and Chrome the click event will no longer fire.
So how to solve the problem?
source share