The global infowindow is exactly what I did. So in the JS library I'm
using I have:

        var infowindow; // the (only) infowindow

in my "loadMap" function I have:

        // make the (only) infowindow object, add event on map: close the
infowindow
        infowindow = new google.maps.InfoWindow();
        google.maps.event.addListener(
                map,
                'click',
                function(){
                        infowindow.close();
                }
        );

The "google.maps.event.addListener" is to allow the user to close the
infowindow by clicking anywhere on the background.
Then when I set a marker, I have the following:

        google.maps.event.addListener(
                marker,
                'click',
                function(){
                        infowindow.close();
                        infowindow.setContent("<b>whatever HTML to show for this
marker<b>");
                        infowindow.open(map, marker);
                }
        );

Seems to work (for example):
http://www.allianz-suisse.ch/portal/site/allianz-suisse/menuitem.483ce1c6c2995bcdae6c621073a08a0c/?vgnextoid=2536b25e9aad0310VgnVCM1000005509a8c0RCRD&lang=de&inputZip=8002&inputCity=&Search=suchen

On Aug 2, 7:18 am, Paul <[email protected]> wrote:
> No, have a 'global' InfoWindow variable so that only one can be open
> at a time.
>
> Glad to hear you think it's possible, just didn't see anything in the
> API reference that seemd to be useful in terms of determining
> InfoWindow state (something like InfoWindow.isOpen())
>
> The map is loaded onto the same page that I will be trying to
> determine the state of the InfoWindow, and I have access to the
> variables that are being used to hold the Map, Markers, marker content
> and the InfoWindow.
>
> Paul
>
> On Aug 2, 1:06 am, "[email protected]" <[email protected]>
> wrote:
>
>
>
>
>
>
>
> > On Aug 1, 9:35 pm, Paul <[email protected]> wrote:
>
> > > I am trying to determine the 'state' of the InfoWindow that is mapped
> > > to a particular Marker. Essentially, in the
> > > google.maps.event.addListener() call, I'd like to check to see if the
> > > InfoWindow is already open, and if it is, close it.
>
> > > Is this possible?
>
> > Why wouldn't it be?  Might not be easy, but doesn't seem hard.
>
> > Needs better definition though.  Where is the map that you are
> > intending to do this on?
> > Are you going to allow multiple infowindows to be open at  a time?
>
> >   -- Larry
>
> > > Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to