Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/397.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在HTML5地理位置请求上显示微调器_Javascript_Jquery_Html_Geolocation - Fatal编程技术网

Javascript 在HTML5地理位置请求上显示微调器

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

我在html网页中有一个按钮,单击该按钮后,它将获得
地理位置
详细信息,可能请求将处理约
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微调器,因为它更可靠


对不起,这个问题与纺纱厂无关。这个问题与纺纱厂无关