Thanks, Esa ! Works like a charm. :)
2011/4/2 Esa <[email protected]> > Click handler should always be created in a separate function. > Otherwise you will face a scope problem (click triggering in wrong > scope). Mike Williams explains it here > http://econym.org.uk/gmap/basic1.htm > That is in v2 syntax but it is still good reading. > > Create a single InfoWindow instance and a function that creates the > 'click' handler for each circle: > > var infoBubble = new google.maps.InfoWindow(); > function makeBubbleHandler(circle, city){ > var iwOptions = { > content: citymap[city].story, > position: citymap[city].center > } > google.maps.event.addListener(circle, 'click', function(){ > infoBubble.setOptions(iwOptions); > infoBubble.open(map); > }); > } > > The code assumes that you have the content in 'story' property of each > cityMap[city] object. > > Then call the function in your for-loop: > > cityCircle = new google.maps.Circle(populationOptions); > makeBubbleHandler(cityCircle, city); > > -- > You received this message because you are subscribed to the Google Groups > "Google Maps JavaScript API v3" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-maps-js-api-v3?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
