1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
var locations = [
['<b>Paris,</b><br> La cité des Titis', 48.8588377,2.2770197, 1, "http://www.aviewoncities.com/img/paris/nav_paris_icon.png"],
['<b>Lyon,</b><br> La cité des Gones', 45.7579341,4.7650806, 2, "http://www.fourviere.org/wp-content/uploads/2014/10/favicon-11.ico"],
['<b>Marseille,</b><br> La cité des Minos', 43.2803051,5.2404104, 3, "https://www.nouvellecaledonie.travel/sites/default/files/2016-09/nature_0.png"]
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 5,
center: new google.maps.LatLng(43.2803051,5.2404104),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
icon: locations[i][4],
map: map
});
google.maps.event.addListener(marker, 'click', (function (marker, i) {
return function () {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
} |
Partager