Saturday, 14 September 2013

get selected marker google maps api 3

get selected marker google maps api 3

in the following code generated an undetermined number of markers, this
works well.
for(i=0;i<idr.length;i++){
var LatLng = new google.maps.LatLng(lat[i], lng[i]);
m[i] = new google.maps.Marker({
position: LatLng,
icon: image,
map: map,
draggable: false,
val: idr[i]
});
}
I want to get the properties of the corresponding marker when the mouse
passes over this
This does not apply for you should create a function for each marker and
can not be that many This function only access the first marker
google.maps.event.addListener(m[0], "click", function(e) {
var latitud = e.latLng.lat();
alert(latitud);
});

No comments:

Post a Comment