2012-02-27 54 views

回答

1

由于您使用jQuery移动已经走了,

.delay() 

从jQuery的。 http://api.jquery.com/delay/

还有一个这样的another question。请注意,jQuery文档声明了这一点 -

.delay()方法最适合延迟排队的jQuery 效果。因为它是有限的 - 例如,它不提供一种方式来取消延迟 - .delay()不是替代JavaScript的原生 setTimeout函数,这可能更适合某些使用 的情况。

这里是jQuery的文档

<!DOCTYPE html> 
<html> 
<head> 
    <style> 
div { position: absolute; width: 60px; height: 60px; float: left; } 
.first { background-color: #3f3; left: 0;} 
.second { background-color: #33f; left: 80px;} 
</style> 
    <script src="http://code.jquery.com/jquery-latest.js"></script> 
</head> 
<body> 

<p><button>Run</button></p> 
<div class="first"></div> 
<div class="second"></div> 

<script> 
    $("button").click(function() { 
     $("div.first").slideUp(300).delay(800).fadeIn(400); 
     $("div.second").slideUp(300).fadeIn(400); 
    }); 
</script> 

</body> 
</html> 
+0

为例,如果以下项目使用效果队列这只会工作。 – rockerest 2012-02-27 14:22:02

0
function loadStuff() 
{ 
    //load stuff 
} 

setTimeout(function(){loadStuff()}, 5000); 

编写你的函数来做你的加载,然后在超时5秒后调用该函数。

0

使用javascript setTimeout()函数。例如setTimeout(“function()”,5000);