我正在使用jquery显示一个图形,需要6到7秒才能加载,所以在那个时候我必须显示图像加载器。在图形加载之前,图像加载器必须至少显示5秒,但其显示仅为1秒。ImageLoader显示不超过1秒
JS:
$(function() {
/** image loader displaying for a sec */
$('#graph').html('<img src="images/loader.gif">');
$('#graph').load(function() {
//data of graph
});
});
HTML:
<div id="graph"></div>
Rohit Batham感谢您的回答。我不能在这里使用setTimeout函数,因为如果网络很慢,图表可能需要超过10到15秒。 – user2721624