I need to have only one InfoWindow open on my Google Map. I need to close all other InfoWindows before I open a new one.
Can someone show me how to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to create just one
InfoWindowobject, keep a reference to it, and reuse if for all the markers. Quoting from the Google Maps API Docs:Therefore, you may simply want to create the
InfoWindowobject just after you initialize your map, and then handle theclickevent handlers of your markers as follows. Let’s say you have a marker calledsomeMarker:Then the
InfoWindowshould automatically close when you click on a new marker without having to call theclose()method.