Close all infowindows in Google Maps API v3

前端 未结 11 1229
小蘑菇
小蘑菇 2020-12-08 00:01

I am busy with a script that will make a google maps canvas on my website, with multiple markers. I want that when you click on a marker, a infowindow opens. I have done tha

11条回答
  •  醉话见心
    2020-12-08 00:40

    I have been an hour with headache trying to close the infoWindow! My final (and working) option has been closing the infoWindow with a SetTimeout (a few seconds) It's not the best way... but it works easely

        marker.addListener('click', function() {
        infowindow.setContent(html);
        infowindow.open(map, this);
    
        setTimeout(function(){
            infowindow.close();
        },5000);
    
    });
    

提交回复
热议问题