Google maps infowindow events on open

后端 未结 1 1243
渐次进展
渐次进展 2021-02-19 03:05

Hi I am using google fusion tables and google maps, the thing is that my markers show up correctly, but I want to insert some images into the inforwindow. So the thing is that

相关标签:
1条回答
  • 2021-02-19 03:49

    The InfoWindow object fires the event domready event when it is attached (fully loaded) to the DOM. You can see this in the API docs: https://developers.google.com/maps/documentation/javascript/reference#InfoWindow

    You could then have a listener like the one below to load content into the infoWindow after it has loaded itself:

    var referenceToInfoWindow = new google.maps.InfoWindow({content: 'My info' });
    
    google.maps.event.addListener(referenceToInfoWindow, 'domready', function(){
        //code to dynamically load new content to infowindow
        //for example:
        //    var existing_content = referenceToInfoWindow.getContent();
        //    var new_content = "...";
        //    referenceToInfoWindow.setContent(existing_content + new_content);
    }); 
    
    0 讨论(0)
提交回复
热议问题