简体   繁体   English

如何在html和javascript中显示隐藏不确定的圆形进度条

[英]How to display a hide indeterminate circular progress bar in html and javascript

Hello am not to familiar with html and JavaScript. 您好不熟悉html和JavaScript。 Am using them because map v3 is available only in JavaScript. 正在使用它们,因为map v3仅在JavaScript中可用。 How do set an indeterminate circular progress bar to display when my map is loading with function initialize and to turn it off after loading. 如何设置不确定的圆形进度条以在使用功能初始化加载地图时显示并在加载后将其关闭。

Make a GIF loading image here - http://www.ajaxload.info/ and download it. 在此处制作一个GIF加载图像-http: //www.ajaxload.info/并下载。 Then upload it to your webserver. 然后将其上传到您的网络服务器。

Then just show it during loading and hide it when complete. 然后仅在加载过程中显示它,并在完成时隐藏它。 Let's say that the image has an ID of loadingIMG: 假设该图片的ID为loadingIMG:

<img src='path/to/image.gif' id='loadingImg' />

//During Loading
$('#loadingImg').show();

//After done loading
$('#loadingImg').hide();

/////////////////// OR for fade in and out //////////////////

//During Loading
$('#loadingImg').fadeIn();

//After done Loading
$('#loadingImg').fadeOut();

Or since you indicated you want the progress element: 或由于您指示您需要进度元素:

<progress id='progressbar' val='0' max='1000' ></progress>
<p id='loadingTxt' style='display: none;'>Loading Location...</p>

//When it is loading...
//Show the loading text
$('#loadingTxt').show();

//During loading, just have dummy progress
var timer = setInterval(function(){ 

     //Incriment Progress bar
     $('#progressbar').attr('value',parseInt($('#progressbar').attr('value'))+10);
}, 1000);

//When completed, set bar to full
//Stop timer,
clearInterval(timer);

//Set to full,
$('#progressbar').attr('value',1000);

//Hide the loading text
$('#loadingTxt').hide();

Just adjust the max val to meet the needs of how fast it loads. 只需调整最大val即可满足加载速度的要求。

Use *.gif image on state loading, and remove it after map load. 在状态加载时使用* .gif图片,并在地图加载后将其删除。 You don't need any animation, just create it in gif. 您不需要任何动画,只需在gif中创建它即可。 Or Use othe image and rotate it via css or js. 或使用其他图像并通过CSS或JS旋转它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM