forked from kartena/Leaflet.zoomslider
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.html
More file actions
48 lines (43 loc) · 1.62 KB
/
test2.html
File metadata and controls
48 lines (43 loc) · 1.62 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="lib/leaflet-0.4.0/leaflet.css" />
<link rel="stylesheet" href="../src/L.Control.Zoomslider.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="lib/leaflet-0.4.0/leaflet.ie.css" />
<link rel="stylesheet" href="../src/L.Control.Zoomslider.ie.css" />
<![endif]-->
</head>
<body>
<div id="map"></div>
<script src="lib/leaflet-0.4.0/leaflet.js"></script>
<script src="../src/L.Control.Zoomslider.js" ></script>
<script src="lib/leaflet-tilejson.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="osm.tilejson.js"></script>
<script>
// Test manual adding and removing of the zoom slider
var map = L.TileJSON.createMap('map', osmTileJSON, {
mapOptions: { zoomsliderControl: false }
});
// Add a zoomend-event. This should remain after the control was removed.
var i = 1;
map.on("zoomend", function(){
console.log("zoomend " + i++);
});
var control = new L.Control.Zoomslider();
map.addControl(control);
// remove the control after two seconds,
// then add it again after another two seconds.
// The zoomend-event aboce should fire all the time.
setTimeout(function(){
map.removeControl(control);
setTimeout(function(){
map.addControl(control);
}, 2000);
}, 2000);
</script>
</body>
</html>