Wednesday, July 25, 2012

Google Maps API multiple markers and infowindows

I was having trouble with binding InfoWindows to markers. No matter which marker was clicked, the InfoWindow for the last marker to be created was displayed.  I found the answer to the problem here:
http://stackoverflow.com/questions/2357323/trying-to-bind-multiple-infowindows-to-multiple-markers-on-a-lgoogle-map-and-fail

Simply creating a separate function to add the event listener solved the problem.

2 comments: