forked from brunob/leaflet.fullscreen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
47 lines (43 loc) · 1.85 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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Leaflet.Control.FullScreen Demo</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4.4/leaflet.ie.css" />
<![endif]-->
<style type="text/css">
#map { width: 700px; height: 433px; }
.leaflet-control-zoom-fullscreen { background-image: url(icon-fullscreen.png); }
.leaflet-control-zoom-fullscreen.last { margin-top: 5px }
/* on selector per rule as explained here : http://www.sitepoint.com/html5-full-screen-api/ */
#map:-webkit-full-screen { width: 100% !important; height: 100% !important; }
#map:-moz-full-screen { width: 100% !important; height: 100% !important; }
#map:full-screen { width: 100% !important; height: 100% !important; }
</style>
<script src="http://cdn.leafletjs.com/leaflet-0.4.4/leaflet.js"></script>
<script src="Control.FullScreen.js"></script>
</head>
<body>
<div id="map"></div>
<script>
var mapbox = new L.TileLayer('http://{s}.tiles.mapbox.com/v3/mapbox.mapbox-light/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: 'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> — © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
});
var map = new L.Map('map', {layers: [mapbox], center: new L.LatLng(48.5, -4.5), zoom: 5});
// create fullscreen control
var fullScreen = new L.Control.FullScreen();
// add fullscreen control to the map
map.addControl(fullScreen);
// detect fullscreen toggling
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>