且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Google Maps API v3 infowindow关闭事件/回调?

更新时间:2022-11-18 08:36:51

infowindows调用 closeclick 可以帮助您的事件

there's an event for infowindows call closeclick that can help you

var currentMark;
var infoWindow = new google.maps.InfoWindow({
            content: 'im an info windows'
        });
google.maps.event.addListener(marker, 'click', function () {
          infoWindow.open(map, this);
          currentMark = this;

});
google.maps.event.addListener(infoWindow,'closeclick',function(){
   currentMark.setMap(null); //removes the marker
   // then, remove the infowindows name from the array
});