在页面加载时显示进度轮 [英] Showing a progress wheel while page loads
问题描述
我需要一个进度轮来显示用户等待时正在进行大量数据库和第三方cURL查询的情况.
I need a progress wheel to show while a lot of database and 3rd Party cURL queries are being made while the user waits.
进度轮应该立即显示吗,还是应该在加载页面模板(但不包含内容)后显示它?
Should the progress wheel show by itself right away, or should I show it once the page template (but not content) has loaded in?
在页面的HTML/javascript完成加载或PHP完成加载之前,我应该显示进度轮吗?
Should I show a progress wheel until the page's HTML/javascript is done loading, or when the PHP is done loading?
如果您可以用原始代码演示大多数人是如何做到的,那将是很好的.我正在使用jQuery,这是一个PHP网站.
If you could show in raw code how most people do this, that'd be great. I'm using jQuery and this is a PHP site.
推荐答案
显示进度条,直到php响应(返回值可能是HTML之一)没有加载到javascript中.
show progress bar until, php response(returned value may be HTML one) is not loaded into javascript.
我应该显示进度轮,直到 页面的HTML/javascript完成 加载,或PHP完成时 正在加载?"
"Should I show a progress wheel until the page's HTML/javascript is done loading, or when the PHP is done loading?"
是这种方法
加载完成后,使用jquery隐藏加载并将内容放入容器类中.
Once loading is complete, hide loading using jquery and put the content in to container class.
<div class="loading">
</div>
<div id="container">
</div>
$('.loading')
.hide() // hide it initially
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
});
这篇关于在页面加载时显示进度轮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!