-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
56 lines (50 loc) · 2.26 KB
/
index.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
var state = "map";
document.getElementById ("toggle").addEventListener ("click", () => {
if (state == "map") {
document.getElementById("map").style.display = "none";
document.getElementById("vr").style.display = "none";
document.getElementById("pix").style.display = "";
document.getElementById("toggle").innerHTML = "View Map";
state = "time"
} else {
document.getElementById("map").style.display = "";
document.getElementById("vr").style.display = "none";
document.getElementById("pix").style.display = "none";
document.getElementById("toggle").innerHTML = "View Timeline";
state = "map"
}
}, false);
document.getElementById("vrbutton").addEventListener("click", () => {
state = "vr"
document.getElementById("map").style.display = "none";
document.getElementById("pix").style.display = "none";
document.getElementById("vr").style.display = "";
}, false);
document.getElementById("year").addEventListener ("input", (event) => {
document.getElementById("yeartext").innerHTML = event.target.value;
if (event.target.value < 1930) {
document.getElementById("photo").src = "./1.jpg";
} else if (event.target.value < 1960) {
document.getElementById("photo").src = "./2.jpg";
} else if (event.target.value < 1990) {
document.getElementById("photo").src = "./3.jpg";
} else {
document.getElementById("photo").src = "./4.jpg";
}
});
var map = L.map('map', { zoomControl: false }).setView([35.78629182935513, -78.66648673212255], 20);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1,
accessToken: 'pk.eyJ1IjoidXg1OTEiLCJhIjoiY2wyY2d6ZzE3MGFpbjNjcm1nczR6dHFjZSJ9.GCrcD26S0CzclPH5ToivhA'
}).addTo(map);
var circle = L.circle([35.78629182935513, -78.66648673212255], {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5,
radius: 30
}).addTo(map);
document.getElementsByClassName( 'leaflet-control-attribution' )[0].style.display = 'none';