docs(tutorial): fix mobile locate accuracy snippey (#6693)

Following PR #6140, the code snippet of mobile tutorial for "locationfound" event needs to be corrected accordingly.
This commit is contained in:
ghybs 2019-06-12 11:20:38 +04:00 committed by Iván Sánchez Ortega
parent 462da25e70
commit 525492bb53

View File

@ -47,7 +47,7 @@ Leaflet has a very handy shortcut for zooming the map view to the detected locat
Here we specify 16 as the maximum zoom when setting the map view automatically. As soon as the user agrees to share its location and it's detected by the browser, the map will set the view to it. Now we have a working fullscreen mobile map! But what if we need to do something after the geolocation completed? Here's what the `locationfound` and `locationerror` events are for. Let's for example add a marker in the detected location, showing accuracy in a popup, by adding an event listener to `locationfound` event before the `locateAndSetView` call:
function onLocationFound(e) {
var radius = e.accuracy / 2;
var radius = e.accuracy;
L.marker(e.latlng).addTo(map)
.bindPopup("You are within " + radius + " meters from this point").openPopup();