javascript - Close Infobox when clicking on the map -
i'm using infobox plugin google maps v3 api (http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html)
is there anyway close infobox when user clicks outside infobox on map?
you want use addlistener()
http://code.google.com/apis/maps/documentation/javascript/events.html#eventlisteners
you can adapt code found here:
google.maps.event.addlistener(_point.popup, 'domready', function() { //have put within domready or else can't find div element (it's null until infobox opened) $(_point.popup.div_).hover( function() { //this called when mouse enters element }, function() { //this called when mouse leaves element _point.popup.close(); } ); });
src: google maps api v3 event mouseover infobox plugin
you can detect map click this:
google.maps.event.addlistener(map, 'click', function() { });
infobox api: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html
Comments
Post a Comment