Google Maps InfoBox or Info Window click eventlistener?

497 views Asked by At

Is there a way of adding a click eventlistener for an info window or an InfoBox (I'm using that plugin)?

Really the problem I'm having is that the window/box is sometimes getting in the way of a click eventlistener that should be triggered when the user clicks anywhere on the map.

1

There are 1 answers

5
geocodezip On BEST ANSWER

from the documentation:

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/examples.html

Using InfoBox to Create a Map Label This example shows how to use an InfoBox as a map label. One important step is to set the pane property to "mapPane" so that the InfoBox appears below everything else on the map. It's also necessary to set closeBoxURL to "" so that the label will not have a close box, to set disableAutoPane to true so that the map does not pan when the label is added, and to set enableEventPropagation to true so that events will be passed on to the map for handling.

from the example referenced above:

    var myOptions = {
             content: boxText
            ,disableAutoPan: false
            ,maxWidth: 0
            ,pixelOffset: new google.maps.Size(-140, 0)
            ,zIndex: null
            ,boxStyle: { 
              background: "url('tipbox.gif') no-repeat"
              ,opacity: 0.75
              ,width: "280px"
             }
            ,closeBoxMargin: "10px 2px 2px 2px"
            ,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
            ,infoBoxClearance: new google.maps.Size(1, 1)
            ,isHidden: false
            ,pane: "floatPane"
            ,enableEventPropagation: false
    };

    var ib = new InfoBox(myOptions);
    ib.open(theMap, marker);