javascript - Close all other InfoWindows when one is clicked -
i trying amend below code other infowindows closed when 1 clicked, 1 open @ once. works great, besides fact user can open 20 infowindows. help. function infowindow(marker, map, title, address, url) { google.maps.event.addlistener(marker, 'click', function () { var html = "<div><h3>" + title + "</h3><p><a href='" + url + "'>read more</a></p></div>"; iw = new google.maps.infowindow({ content: html, maxwidth: 350 }); iw.open(map, marker); }); } if want 1 infowindow, create 1 , move between markers on click event. updated code: // global infowindow var iw = new google.maps.infowindow({ maxwidth: 350 }); function infowindow(marker, map, title, address, url) { google.maps.event.addlistener(marker, 'click', function() { var html = "<div><h3>" + title + "</h3><p><a href='" + url + ...