开发者

close active infowindows from external link google maps api v3

I am working on a website with google maps integrated. http://www.ecompanies.nl/pilot/webdesign/breda.html

Infowindows can be opened by clicking on a map marker, or on a header link in the items listed on the right. How can I close the active infowindow before opening a new one (by clicking on a map marker, or on a header link)?

Thanks in开发者_运维问答 advance. Any help is highly appreciated.


You are creating a new infowindow for each marker. The best way to achieve what you want is to create one infowindow and share that between all the markers.

So:

  1. Put the infowindow creation before the loop.
  2. When you create the click event listener for the marker in the loop add infowindow.setContent('content'); before you open the marker.

this will automatically close the infowindow and open it over the new marker

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜