-
Notifications
You must be signed in to change notification settings - Fork 352
Expand file tree
/
Copy pathindex.html
More file actions
39 lines (34 loc) · 1.23 KB
/
Copy pathindex.html
File metadata and controls
39 lines (34 loc) · 1.23 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css" integrity="sha512-hoalWLoI8r4UszCkZ5kL8vayOGVae1oxXe/2A4AO6J9+580uKHDO3JdHb7NzwwzK5xr/Fs0W40kiNHxM9vyTtQ==" crossorigin="" />
<script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js" integrity="sha512-BB3hKbKWOc9Ez/TAwyWxNXeoV9c1v6FIeYiBieIWkpLjauysF18NzgR1MBNBXf8/KABdlkX68nAhlwcDFLGPCQ==" crossorigin=""></script>
<style>
#map {
height: 400px;
}
</style>
<title>Document</title>
</head>
<body>
<div id="map"></div>
<script>
navigator.geolocation.getCurrentPosition((position) => {
let {
latitude,
longitude
} = position.coords;
var map = L.map('map').setView([latitude, longitude], 19);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
minZoom: 1,
attribution: '© OpenStreetMap'
}).addTo(map);
L.marker([latitude, longitude]).addTo(map);
});
</script>
</body>
</html>