Skip to content
Advertisement

Close all infowindows in Google Maps API v3 [duplicate]

I am busy with a script that will make a google maps canvas on my website, with multiple markers. I want that when you click on a marker, a infowindow opens. I have done that, and the code is at the moment:

JavaScript

This works 100%. But now i want that when one infowindow is open, and you want to open the second, the first one automaticly closes. But i haven’t found a way to do that. infowindow.close(); won’t help. Has someone an example or a solution to this problem?

Advertisement

Answer

infowindow is local variable and window is not available at time of close()

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement