Get all infoWindows on a Google Map

隐身守侯 提交于 2019-12-11 02:24:45

问题


I am working on a map where I neet to plot multiple routes using the DirectionService, and each marker on the route has an infoWindow.
Instead of having to keep track of which infoWindow binds to which marker, is there a way for me to grab all infoWindows on a map?


回答1:


There are no way to do what you want.

The map does not know what markers it have or what infowindows those markers have. The Markers know what map they belong to, but that is it. So unfortunatly you will have to keep track of your markers and infowindows if you want to use them after they are created.




回答2:


Why not just have one infowindow, and set the content of it to be different for each marker? Makes life much simpler (unless you ever need to display more than one infowindow open at the same time)



来源:https://stackoverflow.com/questions/7719441/get-all-infowindows-on-a-google-map

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