J'ai essayé d'ouvrir toutes les infoWindows du marqueur dès que la carte est chargée en premier. Cependant "infoWindow.open (carte, marqueur [i]);" ou d'autres variations ne fonctionne pas. Même j'ai essayé une autre boucle à l'intérieur mais je n'ai pas pu le faire. Donc vous avez des suggestions à ce sujet?Comment ouvrir tous les infowindows par défaut lorsque la carte est chargée?
var spLocations_length = spLocations.length;
// Display multiple markers on a map
var infoWindow = new google.maps.InfoWindow(),
marker, i;
var iconCounter = 0;
// Loop through our array of markers & place each one on the map
for (i = 0; i < spLocations_length; i++) {
var position = new google.maps.LatLng(spLocations[i][1], spLocations[i][2]);
bounds.extend(position);
marker = new google.maps.Marker({
position: position,
map: map,
title: spLocations[i][0],
icon: icons[iconCounter]
});
// Allow each marker to have an info window
google.maps.event.addListener(marker, 'click', (function (marker, i) {
return function() {
infoWindow.setContent(infoWindowContent[i][0]);
infoWindow.open(map, marker);
}
})(marker, i));
// IT DOESN'T WORK FOR OPEN ALL MARKERS INFOWINDOWS WHEN MAP LOADED
infoWindow.open(map, marker[i]);
// Automatically center the map fitting all markers on the screen
map.fitBounds(bounds);
}