页面加载动画无法正确显示
我有简单的 javascript,可以显示和隐藏带有加载图像的 div。 在 chrome(14) 上,ti 似乎工作正常,因为加载图像在每次页面刷新时都会显示。 但是,IE(9) 和 FF(7) 仅在首页调用时显示图像。显示图像一次后,即使页面仍在加载内容,也不再显示图像。
<body>
<div id="loadingDiv">
<div id="loadingImageDiv">
<p><img src="./imgs/loading_1.gif" /></p>
<p><b>Please Wait</b></p>
</div>
</div>
....
$(document).ready(function() {
$("#loadingDiv").show();
$.ajax({
url: "some.json",
contentType: "application/json; charset=utf-8",
dataType: "json",
success:
function(json) {
$.each(json, function(i) {
....
},
complete: function() { $("#loadingDiv").hide(); }
});
});
内容是通过 jquery 中的 ajax 调用加载的。
有什么建议吗?
I have simple javascript which shows and hides div with loading image.
On chrome(14), ti seems working fine since the loading image shows up at every page refresh.
However, IE(9) and FF(7) show the image at first page call only. After it displays the image once, it is not showing the image anymore even though the page still loading content.
<body>
<div id="loadingDiv">
<div id="loadingImageDiv">
<p><img src="./imgs/loading_1.gif" /></p>
<p><b>Please Wait</b></p>
</div>
</div>
....
$(document).ready(function() {
$("#loadingDiv").show();
$.ajax({
url: "some.json",
contentType: "application/json; charset=utf-8",
dataType: "json",
success:
function(json) {
$.each(json, function(i) {
....
},
complete: function() { $("#loadingDiv").hide(); }
});
});
The content is being loaded by ajax call in jquery.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
success
或complete
,但不要同时使用两者。因此,complete
需要看起来像这样:我还没有测试过,但我认为这是正确的。至少要尝试一些东西。
Try using either
success
orcomplete
but not both. Socomplete
would need to look something like this:I haven't tested that, but I think it's right. Something to try, at least.