This repository has been archived by the owner on Feb 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
51 lines (45 loc) · 1.57 KB
/
app.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
const modal_container = document.getElementById('information_container')
const close_information = document.getElementById('close_information')
const input_container = document.getElementById('input_container')
const close_input = document.getElementById("close_input")
function initMap(){
// map option
var options = {
center:{lat: 49.2827, lng: -123.120},
zoom: 15
}
// new map
map = new google.maps.Map(document.getElementById('map'), options)
// marker tester
/*
const marker = new google.maps.Marker({
position:{lat: 49.2716, lng:-123.0947},
map:map
});
*/
async function addMarker(property){
const marker = new google.maps.Marker({
position: property.location,
map:map
})
input_container.classList.add('Show');
close_input.addEventListener("click", () => {
input_container.classList.remove('Show');
})
input_container.addEventListener("click", () => {
input_container.classList.remove('Show');
})
marker.addListener("click", () => {
information_container.classList.add('Show');
close_information.addEventListener("click", () => {
information_container.classList.remove('Show');
})
modal_container.addEventListener("click", () =>{
information_container.classList.remove('Show');
})
})
}
google.maps.event.addListener(map, "click", (event) => {
addMarker({location:event.latLng});
})
}