javascript - How To Add Event Listener To OverlayView? -


i trying create overlayview on google map custom marker.

i able create overlayview following.

http://plnkr.co/edit/4xdane?p=preview

however, when try add event listeners it, got stuck.

i tried followings no luck.

    // ------------- trying add dom event listener ---     google.maps.event.adddomlistener(this.div, 'click', function(){       alert(1); // not working     })      // ------------- or, ---     this.div.addeventlistener('click',function() {       alert(1); // not working     }); 

anyone made successfully?

----- update ---- per @dr-molle suggests, following accepts mouse click.

    //panes.overlaylayer.appendchild(div);   not     panes.overlaymousetarget.appendchild(div);  // but,      // ------------- trying add dom event listener ---     google.maps.event.adddomlistener(this.div, 'click', function(){       alert(1); // working     }) 

you must use different pane layer.

currently use overlaylayer, overlaymousetarget , floatpane may receive dom-events.

i suggest use overlaymousetarget , overlays act markers in case(infowindows opened in front of overlays)


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -