Created
April 1, 2021 03:43
-
-
Save m3l1nd4/6b73713546ea36b2c5548b6782bab7c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gives back the current location & adds a marker to the map | |
// onSuccess callback accepts a Position object, which contains the current coordinates | |
// onError callback receives a PositionError object | |
function currentLocation(map) { | |
navigator.geolocation.getCurrentPosition(function (position) { | |
onSuccess(map, position); | |
document.getElementById("shop-location").value = position.coords.latitude + " " + position.coords.longitude; | |
}, onError); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment