-
Notifications
You must be signed in to change notification settings - Fork 15
/
hexbar_demo.html
64 lines (57 loc) · 1.71 KB
/
hexbar_demo.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Footprints demo styles</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.mapbox.com/mapbox-gl-js/v1.11.0/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.11.0/mapbox-gl.css" rel="stylesheet" />
<style>
body { margin: 0; padding: 0; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
</style>
</head>
<body>
<style>
#menu {
position: absolute;
background: #fff;
padding: 10px;
font-family: 'Open Sans', sans-serif;
}
</style>
<div id="map"></div>
<div id="menu">
<input
id="ckckcrh7a4v981io5wc1dje4j"
type="radio"
name="rtoggle"
value="ckckcrh7a4v981io5wc1dje4j"
checked="checked"
/>
<label for="ckckcrh7a4v981io5wc1dje4j">Hexbars</label>
<input id="ckclr4okf0wlj1io05e7m6lqy" type="radio" name="rtoggle" value="ckclr4okf0wlj1io05e7m6lqy" />
<label for="ckclr4okf0wlj1io05e7m6lqy">Hexbars pink</label>
<input id="ckclrcuzq0xgs1is17i7pmsw2" type="radio" name="rtoggle" value="ckclrcuzq0xgs1is17i7pmsw2" />
<label for="ckclrcuzq0xgs1is17i7pmsw2">Hexbars 2D</label>
</div>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoidGp1a2Fub3Z0IiwiYSI6ImNrNTdxempkZTBmeTczZmxqdmxmNHlqczAifQ.a_BL5RTprJKXwaTzbsPeyw';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/tjukanovt/ckckcrh7a4v981io5wc1dje4j',
zoom: 14,
center: [2.36, 48.85]
});
var layerList = document.getElementById('menu');
var inputs = layerList.getElementsByTagName('input');
function switchLayer(layer) {
var layerId = layer.target.id;
map.setStyle('mapbox://styles/tjukanovt/' + layerId);
}
for (var i = 0; i < inputs.length; i++) {
inputs[i].onclick = switchLayer;
}
</script>
</body>
</html>