2017-02-28 216 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