locate with high accuracy

This commit is contained in:
Götz 2017-10-14 01:46:47 +02:00
parent 8c88520f8c
commit fda6634c6f

View File

@ -55,8 +55,14 @@ function resizeMap() {
document.getElementById('map').style.height = height + 'px'
}
/**
* save current position in global vars
*/
function getPos() {
if (navigator.geolocation) {
var geo_option = {
enableHighAccuracy: true,
}
navigator.geolocation.getCurrentPosition(function (position) {
console.log(position);
startLat = position.coords.latitude;
@ -64,7 +70,7 @@ function getPos() {
}, function (err) {
console.log(err.code)
console.log(err.message)
})
}, geo_option)
} else {
document.getElementById('map').innerHTML('Geolocation not available')
}