This repository has been archived by the owner on Apr 3, 2023. It is now read-only.
forked from torfsen/leaflet.zoomhome
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
74 lines (69 loc) · 2.86 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>leaflet.zoomhome demo</title>
<link rel="stylesheet" href="https://npmcdn.com/[email protected]/dist/leaflet.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="dist/leaflet.zoomhome.css"/>
<style>
html, body, #map {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
#legend {
margin: 3em;
border: 1px solid #555;
background-color: #fafafa;
padding: 1em;
border-radius: 6px;
-o-border-radius: 6px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
color: #555;
width: 22em;
}
#legend p {
margin: 0;
}
#legend h1 {
margin-top: 0;
font-size: 120%;
}
</style>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://npmcdn.com/[email protected]/dist/leaflet.js"></script>
<script src="dist/leaflet.zoomhome.min.js"></script>
</head>
<body>
<div id="map"></div>
<div id="legend">
<h1>leaflet.zoomhome demo</h1>
<p><a href="https://github.com/torfsen/leaflet.zoomhome">leaflet.zoomhome</a> is a small
<a href="http://www.leafletjs.com">Leaflet</a>-plugin for a zoom control that includes a
home button to reset the view.</p>
</div>
<script>
var TILES_URL = 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
INITIAL_LOCATION = [49.0140679, 8.4044366],
INITIAL_ZOOM = 13,
ATTRIBUTION = 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> ' +
'contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">' +
'CC-BY-SA</a>. Tiles © <a href="https://carto.com/attributions">' +
'Carto</a>';
$(document).ready(function() {
var tiles = L.tileLayer(TILES_URL, {attribution: ATTRIBUTION});
var map = L.map('map', {zoomControl: false}).addLayer(tiles).setView(INITIAL_LOCATION, INITIAL_ZOOM);
var legend = L.control({position: 'bottomright'});
legend.onAdd = function (m) {
return L.DomUtil.get('legend');
};
legend.addTo(map);
var zoomHome = L.Control.zoomHome();
zoomHome.addTo(map);
});
</script>
</body>
</html>