Javascript 在HTML5地理位置请求上显示微调器
我在html网页中有一个按钮,单击该按钮后,它将获得Javascript 在HTML5地理位置请求上显示微调器,javascript,jquery,html,geolocation,Javascript,Jquery,Html,Geolocation,我在html网页中有一个按钮,单击该按钮后,它将获得地理位置详细信息,可能请求将处理约5秒,因此最好向用户显示微调器或加载消息,以指示他们的请求正在处理 这就是我试过的 if (navigator.geolocation) { //request starts Showing the spinner at this point. navigator.geolocation.getCurrentPosition(function(position) { //ge
地理位置
详细信息,可能请求将处理约5秒
,因此最好向用户显示微调器或加载消息,以指示他们的请求正在处理
这就是我试过的
if (navigator.geolocation) {
//request starts Showing the spinner at this point.
navigator.geolocation.getCurrentPosition(function(position) {
//get coordinates
}, function (error) {
// Handle errors !!This callback isn't execute if a user close the
// geolocation prompt or click on `Not Now` option in the prompt
// So its not always correct to hide the spinner in here.
}, {enableHighAccuracy: true, timeout: 8000});
}
将微调器隐藏在errorCallback
中并不总是正确的,因为如果用户关闭地理位置提示符
或单击提示符中的现在不
选项,则不会执行此回调,如下图所示
最好的方法是什么?使用Jquery微调器,因为它更可靠
使用Jquery微调器,因为它更可靠
对不起,这个问题与纺纱厂无关。这个问题与纺纱厂无关