-
Notifications
You must be signed in to change notification settings - Fork 4
/
sync-multiple.html
75 lines (66 loc) · 2.14 KB
/
sync-multiple.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
64
65
66
67
68
69
70
71
72
73
74
75
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Leaflet Synchronized View of Multiple Media Demo - with three maps listening</title>
<link rel="stylesheet" href="css/leaflet-0.5.1.css" />
<!--[if lte IE 8]> <link rel="stylesheet" href="css/leaflet-0.5.1.ie.css" /> <![endif]-->
<style type="text/css">
html, body { width: 100%; height: 100%; margin: 0; }
#map, #container { width: 49.5%; height: 100%; }
#map { float: left; }
#container { float: right; }
#container .map { width: 100%; height: 50%; }
</style>
</head>
<body>
<div id="map"></div>
<div id="container">
<div id="mapA" class="map"></div>
<div id="mapB" class="map"></div>
<div id="mapC" class="map"></div>
</div>
<script src="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js"></script>
<script src="js/L.Map.Sync.js"></script>
<script>
var center = [59.336, 5.967];
var stamenOptions = {
attribution:
'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' +
'<a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — ' +
'Map data OpenStreetmap',
subdomains: 'abcd',
minZoom: 0,
maxZoom: 20
};
var toner = L.tileLayer('http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png', stamenOptions);
var tonerLite = L.tileLayer('http://{s}.tile.stamen.com/toner-lite/{z}/{x}/{y}.png', stamenOptions);
var watercolor = L.tileLayer('http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg', stamenOptions);
var map = L.map('map', {
layers: [toner],
center: center,
zoom: 14
});
var mapA = L.map('mapA', {
layers: [watercolor],
center: center,
zoom: 14,
zoomControl: false
});
var mapB = L.map('mapB', {
layers: [tonerLite],
center: center,
zoom: 14,
zoomControl: false
});
map.sync(mapA);
map.sync(mapB);
// If you want interaction with mapA|B to be synchronized on map,
// add other links as well.
// mapA.sync(map);
// mapA.sync(mapB);
// mapB.sync(map);
// mapB.sync(mapA);
</script>
</body>
</html>