-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
72 lines (60 loc) · 1.92 KB
/
script.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
function RangeOnType()
{
var myInputValue = $("#start").val();
$("#outputText").text(myInputValue);
ChangeMarkersVisibility(myInputValue);
console.log(myInputValue);
};
function ChangeMarkersVisibility(year)
{
switch(year) {
case '2018' :
console.log("nous sommes en 2018");
break;
case '2019' :
console.log("nous sommes en 2019");
break;
case '2020' :
console.log("nous sommes en 2020");
break;
case '2021' :
console.log("nous sommes en 2021");
break;
case '2022' :
console.log("nous sommes en 2022");
var markerLocation = new L.LatLng(-0.1244324, 51.5006728);
var marker = new L.Marker(markerLocation);
mymap.addLayer(marker);
marker.bindPopup("nous sommes en 2022");
break;
}
};
$(function() {
$('#outputText').text('--'); // Valeur par défaut
$('#start').on('input', RangeOnType);
});
var mymap = L.map("mapid").setView([51.505, -0.09], 13);
var markers = [
[-0.119623, 51.503308, "London Eye", 2018],
[-0.1279688, 51.5077286, "Nelson's Column", 2019]
];
for (var i = 0; i < markers.length; i++) {
var lon = markers[i][0];
var lat = markers[i][1];
var popupText = markers[i][2];
var markerLocation = new L.LatLng(lat, lon);
var marker = new L.Marker(markerLocation);
mymap.addLayer(marker);
marker.bindPopup(popupText);
}
L.tileLayer(
"https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}",
{
attribution:
'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: "mapbox.streets",
accessToken:
"pk.eyJ1IjoicGF1bG1hc3NlbmRhcmkiLCJhIjoiY2pvcG45dHU4MDAwdTNrb3p5a3lnYW1mNyJ9.4PIUsWrAuSf10ovHXoxTpw"
}
).addTo(mymap);