2017-02-28 164 views
0

我试图显示地图中的位置,我已经在我的数组中列出了左侧的位置。如果用户点击列表中的任何位置,地图应显示该特定位置和信息窗口。这里的问题是,如果我点击任何其他位置的先前点击信息窗口仍然出现在地图上,我怎么能隐藏它在地图上?显示信息窗口被点击的元素隐藏其他

code

+0

https://github.com/kannan007/Neighborhood-Map这里是我的回购 – Kannan

+1

显示的代码无法链接.. – scaisEdge

+0

http://codepen.io/kannant14/pen/KWdWWN在这里你去 – Kannan

回答

1

要创建每次点击的地点之一,而不是为他们节省了进一步的使用时间新infoWindow实例。

我已经修改您的代码中两个功能

1. populateInfoWindow 
    (added condition here to check if there is an infoWindow created already, 
    if yes then use that else create new and save it under the same marker) 

2. showListings  
    (if marker visibility is false then call close function of its infoWindow) 

工作CodePen

+0

感谢分配它的工作完美 – Kannan

+0

兄弟在那里?还有另一个问题 – Kannan

+0

清除自己兄弟谢谢 – Kannan