-
Notifications
You must be signed in to change notification settings - Fork 0
/
maps-demo.html
39 lines (35 loc) · 1.45 KB
/
maps-demo.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" crossorigin=""></script>
<style>
#my-map {
height: 300px;
}
.target-list {
overflow: auto;
max-height: 240px;
}
</style>
<script>
$(document).ready(createMap);
function createMap() {
var map = new L.Map('my-map');
new L.TileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
zoom: 13,
'attribution': 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'
}).addTo(map);
navigator.geolocation.getCurrentPosition(function(location) {
deviceLocation = L.latLng(location.coords.latitude, location.coords.longitude);
map.setView(deviceLocation, 16);
});
}
</script>
</head>
<body>
<div id="my-map"></div>
</body>
</html>