Closed supun151515 closed 9 years ago
Hi,
Yes there is, but it is not supported by the plug-in out of the box. You just need to do something like:
// Initialize component
$('#somecomponent').locationpicker();
// Get current location from the browser
navigator.geolocation.getCurrentPosition(function(position) {
// You can set it the plugin
$('#somecomponent').locationpicker('location', {
latitude: position.coords.latitude,
longitude: position.coords.longitude,
});
});
But you should keep in mind that:
if ("geolocation" in navigator) {
/* geolocation is available */
} else {
/* geolocation IS NOT available */
}
Let me know if this works for you.
Cheers, Dmitry
Is there a way to get my current location? If yes, kindly explain it. Put it in your documentation as well.
Thank you, Supun Silva