var savedLocation = null;
function savePosition() {
savedLocation = map.getCenter();
}
function returnToSavedPosition() {
if (savedLocation)
map.setCenter(savedLocation);
}
When you open an infowindow, call savePosition(), ie wherver you call
a infowindow.open
and attach a eventListener to the same infowindow
google.maps.event.addListener(infowindow, 'closeclick', function() {
returnToSavedPosition();
});
On Wed, Sep 7, 2011 at 11:01 PM, Natalie O'Toole <[email protected]> wrote:
> Hi,
>
> Is there a way to do the following in Google Maps Javascript API v3:
>
> GEvent.addListener(map, 'infowindowopen', function()
> { map.savePosition(); });
>
> GEvent.addListener(map, 'infowindowclose', function()
> { map.returnToSavedPosition(); });
>
> The code above was created in v2.
> I'm trying to have the map revert back to its original position (centered)
> when the user closes the info window.
>
> Help please.
>
> Nat
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps JavaScript API v3" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-maps-js-api-v3/-/ndwsJgSvdb4J.
> 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.
>
--
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.