-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.html
94 lines (80 loc) · 2.76 KB
/
index.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Leaflet.ZoomFS demo</title>
<!-- Leaflet CSS. REQUIRED! -->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css">
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.ie.css" />
<![endif]-->
<style>
/**
* base map styles
* position and height are required by Leaflet
* inline styles are removed by Leaflet.Control.ZoomFS so be sure to declare a height in your base CSS!
* you can get away without delcaring a position, but it's recommended...
*/
#map {
height: 433px;
width: 700px;
margin: 50px auto;
}
/**
* you can customize this class however you need to.
* the important rules are position, width, height
*/
#map.leaflet-fullscreen {
position: fixed;
width: 100%;
height: 100%;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: 0;
padding: 0;
border: 0;
}
/**
* there are no internal button styles; you must add your own like this:
*/
.leaflet-control-fullscreen {
background-image: url(http://f.cl.ly/items/0W2V081o1h3p013P2v46/icon-fullscreen.png);
}
</style>
</head>
<body>
<!-- map container -->
<div id="map"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js"></script>
<script src="leaflet.zoomfs.js"></script>
<script>
// init map without default zoom controls
var map = new L.Map('map', { zoomControl: false });
// create tile layer and center map: default Leaflet stuff
var osmTiles = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a>',
maxZoom: 18
});
var etown = new L.LatLng(53.52327, -113.53297);
map.setView(etown, 13).addLayer(osmTiles);
// create custom zoom control with fullscreen button
var zoomFS = new L.Control.ZoomFS();
// add custom zoom control
map.addControl(zoomFS);
// you can bind to 2 events: enterFullscreen and exitFullscreen
// note that these events are on the map object, not the zoomfs object...
map.on('enterFullscreen', function() {
if (window.console) window.console.log('enterFullscreen');
});
map.on('exitFullscreen', function() {
if (window.console) window.console.log('exitFullscreen');
});
</script>
</body>
</html>