Closing info windows in google maps by clicking the map?

google-maps-api-3

Solution

add listener to map's click event and close infoboxes in its handler

google.maps.event.addListener(map, "click", function(event) {
    for (var i = 0; i < ibArray.length; i++ ) {  //I assume you have your infoboxes in some array
         ibArray[i].close();
    }
});

I do that on typical websites, but don't see any reason it wouldn't work on mobile

Problem

I'm making a mobile web app. Part of the app drops several markers, which can be clicked to open info windows. It irritates me that these do not go away if you continue using the map without acknowledging them, as in the iOS maps app. Is there a way to set it so that if the user clicks the underlying map, all open info windows are closed?

Original source

Related problems