-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
56 lines (48 loc) · 1.16 KB
/
main.js
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
let map;
function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
mapId: "876806baa0024d81",
center: { lat: 40.73090330192132, lng: -73.99024079492982 },
zoom: 17,
});
const markers = [
{
title: "一風堂",
lat: 40.73090330192132,
lng: -73.99024079492982,
url: "./javascript.svg",
width: 38,
height: 38,
},
{
title: "ICHIRAN Ramen ",
lat: 40.76010005715904,
lng: -73.98328257794572,
url: "./javascript.svg",
width: 38,
height: 38,
},
];
markers.map((currMarker) => {
const marker = new google.maps.Marker({
position: { lat: currMarker.lat, lng: currMarker.lng },
icon: {
url: currMarker.url,
scaledSize: new google.maps.Size(currMarker.width, currMarker.height),
},
map,
title: currMarker.title,
animation: google.maps.Animation.DROP,
});
const infowindow = new google.maps.InfoWindow({
content: currMarker.title,
});
marker.addListener("click", () => {
infowindow.open({
anchor: marker,
map,
});
});
});
}
window.initMap = initMap;