info bulle marqueur
Posté : 13 mars 2017, 15:56
Bonjour, j'aimerai pouvoir afficher une info bulle sur chaque marqueur créer mais ça me créer une info bulle juste pour le dernier élément, ce qui est normal vu mon code mais je n'arrive pas à trouver un moyen pour le faire sur chaque
Merci 
Code : Tout sélectionner
for (var i=0 ; i<myLatLng.length-1 ; i++){
var optionsmarqueur={
position: new google.maps.LatLng(myLatLng[i][0], myLatLng[i][1]),
map: map,
title: 'Adresse n°'+i
}
var marqueur = new google.maps.Marker(optionsmarqueur);
var contenuInfoBulle = ' Coordinate:' + i + ' <br />Lat: <span id="lat_point">' + myLatLng[i][0] +'</span> , Lng: <span id="lng_point">' + myLatLng[i][1]+'</span><br />'+ '</span>'+
'Battery: <span id="_id_cap">' + myLatLng[i][2] + '</span>%';
var infoBulle = new google.maps.InfoWindow({
content: contenuInfoBulle
})
google.maps.event.addListener(marqueur, 'click', function() {
infoBulle.open(map, marqueur);
});
infoBulle.close();