As the title states, on a given event (for me this happens to be upon opening a new google.maps.InfoWindow
I want to be able to close any other currently open info
infowindow is local variable and window is not available at time of close()
var latlng = new google.maps.LatLng(-34.397, 150.644); var infowindow
= null;
...
google.maps.event.addListener(marker, 'click', function() {
if (infowindow) {
infowindow.close();
}
infowindow = new google.maps.InfoWindow();
... });
...
REF: Close all infowindows in Google Maps API v3