单击的元素的显示信息 Windows 隐藏其他元素
Show Info Windows of the elements which are clicked hide the others
我正在尝试显示我数组中的地图位置,我已在左侧列出了位置。如果用户单击列表中的任何位置,地图应显示该特定位置和信息 Window。这里的问题是,如果我点击任何其他位置,之前点击的信息 Window 仍然出现在地图上,我怎样才能将它隐藏在地图中?
我的code
每次单击其中一个位置并且不保存它们以供进一步使用时,您都会创建一个新的 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
我正在尝试显示我数组中的地图位置,我已在左侧列出了位置。如果用户单击列表中的任何位置,地图应显示该特定位置和信息 Window。这里的问题是,如果我点击任何其他位置,之前点击的信息 Window 仍然出现在地图上,我怎样才能将它隐藏在地图中?
我的code
每次单击其中一个位置并且不保存它们以供进一步使用时,您都会创建一个新的 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