Jednoduchá geolokace.
parent
f268212a07
commit
6e286c0ea5
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
|
||||
{* bootstrap: *}
|
||||
<link href="{$basePath}/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
|
|
|||
|
|
@ -1,14 +1,8 @@
|
|||
{* This is the welcome page, you can delete it *}
|
||||
|
||||
{block content}
|
||||
<div id="banner">
|
||||
<h1 n:block=title>Obvody</h1>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<div id="map"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="{$basePath}/js/mapa.js"></script>
|
||||
<script src="{$basePath}/js/obvody.js"></script>
|
||||
|
|
|
|||
|
|
@ -1 +1,8 @@
|
|||
#map { height: 720px; }
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
html, body, #map {
|
||||
height: 100%;
|
||||
width: 100vw;
|
||||
}
|
||||
|
|
@ -2966,3 +2966,23 @@ geojson = L.geoJSON(geojsonFeature, {
|
|||
style: style,
|
||||
onEachFeature: onEachFeature
|
||||
}).addTo(map);
|
||||
|
||||
// geolokace:
|
||||
map.locate({setView: true, maxZoom: 16});
|
||||
|
||||
function onLocationFound(e) {
|
||||
var radius = e.accuracy;
|
||||
|
||||
L.marker(e.latlng).addTo(map)
|
||||
.bindPopup("Nacházíte se v okolí " + radius + " metrů od tohoto bodu.").openPopup();
|
||||
|
||||
L.circle(e.latlng, radius).addTo(map);
|
||||
}
|
||||
|
||||
map.on('locationfound', onLocationFound);
|
||||
|
||||
function onLocationError(e) {
|
||||
alert(e.message);
|
||||
}
|
||||
|
||||
map.on('locationerror', onLocationError);
|
||||
Loading…
Reference in New Issue