Javascript-Jquery Geolocation and locationpicker -
$(function() { if (navigator.geolocation) { navigator.geolocation.getcurrentposition(showposition); } else { $('#us2').locationpicker({ location: { latitude: 41.0918692, longitude: 29.0602068 }, radius: 0, scrollwheel: false, inputbinding: { latitudeinput: $('#us2-lat'), longitudeinput: $('#us2-lon'), radiusinput: $('#us2-radius'), locationnameinput: $('#us2-address') } }); } function showposition(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; // binding ui widget $('#us2').locationpicker({ location: { latitude: lat, longitude: lon }, radius: 0, scrollwheel: false, inputbinding: { latitudeinput: $('#us2-lat'), longitudeinput: $('#us2-lon'), radiusinput: $('#us2-radius'), locationnameinput: $('#us2-address') } }); } });
i did script. have problem. when open result page , clicked share location option when asked, everythings fine opens direction on map. when didnt share location dont show map becouse of cant find coordinates. when people dont share location want set coordinates latitude: 41.0918692 , longitude: 29.0602068 can see @ code. think if(navigator.geolocation) code doesnt work.
Comments
Post a Comment