Google Maps API-如何在打开新的信息窗口时关闭所有打开的信息窗口?

时间:2019-01-18 16:42:59

标签: javascript google-maps

我具有以下功能,可以打开标记的信息窗口,我正在努力了解如何在打开另一个窗口之前先关闭活动的/已打开的信息窗口,这样一次只能激活一个信息窗口?

$3 abcd
23 xyz
1234 abc

1 个答案:

答案 0 :(得分:0)

请参阅其他问题的答案。 Close all infowindows in Google Maps API v3

google.maps.event.addListener(map_marker, 'click', function () {
if (info_window) {
    info_window.close();
}
info_window.setContent(this.html)
info_window.open(self.map, this)
document.querySelector("#js-reset-zoom").classList.remove('active')

})

this.map_markers.push(map_marker)

相关问题