-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
56 lines (45 loc) · 1.06 KB
/
app.js
File metadata and controls
56 lines (45 loc) · 1.06 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// AIzaSyBeh47W7e_8CXydTeB9YgXb-MnI-REt2GM AIzaSyBQz-dulnebn0pqnUxRai6D4L6I5smV-h8
// Map options
window.initMap= function(){
var options = {
zoom:8,
center:{lat:41.608635,lng:21.745274999999992}
}
// New Map
var map = new
google.maps.Map(document.getElementById('map'),options);
// Array of markers
var markers = [
{
coords:{lat:41.1231,lng:20.8016},
content:'<h1>Ohrid</h1>'
},
{
coords:{lat:41.03143,lng:21.33474},
content:'<h1>Bitola</h1>'
},
{
coords:{lat:41.9973,lng:21.4280},
content:'<h1>Skopje</h1>'
}
]
// loop
for(var i = 0; i<markers.length;i++){
addMarker(markers[i]);
}
// add marker function
function addMarker(props){
var marker = new google.maps.Marker({
position:props.coords,
map:map
});
if(props.content){
var infoWindow = new google.maps.InfoWindow({
content:props.content
});
marker.addListener('click', function() {
infoWindow.open(map,marker);
});
}
}
}