forked from enesigneci/Google-Maps-API-Array-Marker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiplelocations.js
More file actions
29 lines (25 loc) · 942 Bytes
/
multiplelocations.js
File metadata and controls
29 lines (25 loc) · 942 Bytes
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
27
28
29
var map;
var locations = [
['İstanbul', 41.015137,28.979530],
['Edirne', 41.674965,26.583481]
];
function makeMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 35, lng: 39},
zoom: 2
});
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]),
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
}