2011-05-24 67 views
0

您好我想知道是否有任何技术可以通过它来控制使用jquery的加载图像可以长时间显示的时间。例如:在jquery中显示加载图像很长时间

$('#ajax').html('<img src="ajax.gif"/>'); 
$('#iframe').load('file.php'); 

现在我想知道有什么方法可以通过它显示ajax.gif指定的时间?请告诉我。

+0

阅读'setTimeOut':https://developer.mozilla.org/en/DOM/window.setTimeout – diEcho 2011-05-24 05:50:49

回答

1

尝试

var loader = '<img id="loader" src="http://tools.patentcalls.com/images/spinner.gif"/>'; 
jQuery(document).ready(function() { 
    setTimeout(function() { 
     jQuery('#ajax').html(loader); 
    }, 1000); 
    jQuery('#iframe').load('file.php'); 
}); 
+0

看到这一个也将是有帮助的:HTTP://plugins.jquery。 com/project/throbber – diEcho 2011-05-24 05:58:43

+0

@diEcho:在哪里放置$('#iframe')。load('file.php');声明呢?请你可以编辑上面的代码? – 2011-05-24 06:05:24

+0

@sanks,更新我的答案;现在看到 – diEcho 2011-05-24 06:08:30