Thanks, that's the method I ended up using, just wondered if there were any built-in mechanisms for tracking InfoWindow state.
On Aug 2, 4:05 pm, "[email protected]" <[email protected]> wrote: > On Aug 2, 12:41 pm, Paul <[email protected]> wrote: > > > Thanks for the help guys... it's almost what I need, but specifically, > > I am looking for 'toggle' functionality when a marker is clicked, not > > the rest of the map. Some piece of code that in the Marker's click > > listener can check > > > if InfoWindow is open > > close it > > else > > open it > > end if > > What problem are you having implementing this? I would think given > your responses (that there is only one infowindow open at a time) it > would be pretty straightforward. > > one possible approach: > 1. give each marker an id > 2. save that id in a global variable when the infowindow is opened > 3. mark it as "none" when the infowindow is closed > 4. in the click listener check if the current marker's infowindow is > active before opening it, if it is, close it. > > -- Larry > > > > > > > > > > > On Aug 2, 10:19 am, Alex Franco <[email protected]> wrote: > > > > If you have a global variable, it's easy, I wrote a post about that, > > > hope could help you, is in spanish, but, only what you need is the > > > code, check it > > > Posthttp://jafrancov.com/2010/09/single-infowindow/ > > > Examplehttp://jafrancov.com/demos/single-infowindow.php > > > > The central idea: write a click listener for the map variable, so, > > > when you click anywhere (different from the marker of course), call > > > the function close of the infowindow variable. > > > > -- > > > Alex Franco > > > > On 2 ago, 01:18, 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.
