Hello! I am using Google Maps V3, and I have the following question.

I understand that if I have multiple markers on a map, and I need to
handle clicks on them, I have to set up a handler for each marker like
so:

// ...
var marker = new google.maps.Marker({position: new
google.maps.LatLng(55, 37)});
marker.setMap(map);
var listener = google.maps.event.addListener(marker, 'click',
function(event){
    // my listener handler here
});

But if I have a lot of markers, wouldn't it bee too heavy? Can I
somehow set one handler and figure out which marker was clicked inside
it? Like:

// ...
var listener = google.maps.event.addListener(map, 'click',
function(event){
    var target = event.target; // Click target
});

-- 
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.

Reply via email to