Google maps infowindow events on open

ぃ、小莉子 提交于 2019-12-04 00:34:07

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);
}); 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!