function bindInfoWindow(marker, map, infoWindow, html) {
//infoWindow.close(); <---- ignore this one
google.maps.event.addListener(marker, 'click', function() {
infoWindow.close();
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
}
This is my function with the listener for when a marker is clicked but regardless to what I do the infoWindows will NOT close unless I click them they just stay on the screen when I click them and sometimes I get an error that there is no Close function. Someone help please!
InfoWindow close works just fine. I suspect you are expecting it to close a different infowindow.
In your example it will close the infowindow (if it is open) and open it immediately again, you probably won't see that.
Try adding:
google.maps.event.addListener(map, "click", function() {infoWindow.close();});
Then clicking on the map. Note, this is probably not your final solution, just a technique to show you it does close.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.