Hi- Thanks,
Do you mean the example is on the "settings" of your platform?
That's correct. Copy, paste and adjust this code to meet your demands. It's all you need.
Download and insert the script
/js/helpers/gmaps.min.js to your site
function loadLocationWrong() { buttonWrong.style.visibility = 'hidden'; retry.style.visibility = 'visible'; //.removeAttribute("readonly"); if (address.value != '') { address.removeAttribute("readonly"); } if (city.value != '') { city.removeAttribute("readonly"); } if (region.value != '') { region.removeAttribute("readonly"); } if (country.value != '') { country.removeAttribute("readonly"); } //enable other button... location-text-address-retry // $("location-text-address").attr("readonly", false);} function loadLocation() { //location-text-state-city //location-text-country buttonWrong.style.visibility = 'visible'; if (navigator.geolocation) { var iscoords = true; navigator.geolocation.getCurrentPosition(function(position){ loadPosition(position, true); }); } else { //ask to upgrade browser. } } function loadPosition(position, iscoords) { if (iscoords === true) { geocoder.geocode({ 'address': position.coords.latitude + "," + position.coords.longitude }, function (data, status) { sortAddress(data); }); } else if (iscoords === false) { retry.style.visibility = 'hidden'; address.readOnly = true; city.readOnly = true; region.readOnly = true; country.readOnly = true; geocoder.geocode({ 'address': address.value + ", " + city.value + ", " + region.value + ", " + country.value }, function (results, status) { sortAddress(results); }); } /* state.value = position.coords.latitude; country.value = position.coords.longitude; */ }
-----------------------------------------Additional--Items-----------------------------------------
View sourceFocus on functions:
loadLocation
loadPosition
loadLocationWrong
Thank you for your work, and info here.