Can anyone help me code inside my eventListener so that an infowindow will do the following: open if it\'s currently closed, and close if it\'s currently open.
I\'ve
var currentInfoWindow = null;
then on every marker click event I do something like this:
var infowindow = new google.maps.InfoWindow({
content: "your content here"
});
google.maps.event.addListener(marker, 'click', function() {
if (currentInfoWindow != null) {
currentInfoWindow.close();
}
infowindow.open(map, marker);
currentInfoWindow = infowindow;
});
Source : https://groups.google.com/forum/#!topic/google-maps-js-api-v3/cA2VRg4TO1k