這是我到目前爲止。我想爲功能spid()
設置超時。如何設置此jQuery代碼的超時時間?
<script type="text/javascript">
$(document).ready(function() {
$("#spid").animate({top: '-110px' }, 600, 'easeOutBounce',
function spid() {
$(this).animate({top:"-=20px"},1000).animate({top:"+=20px"},1000);
setTimeout("spid()",2000);
});
});
爲' setInterval'&'setTimeout',請不要傳遞參數作爲字符串。雖然這是正確的方式,但耗時'因爲字符串再次需要解析 – 2010-09-20 16:41:55
你能給我一個例子 – Noob 2010-09-20 16:42:31
這不需要一個例子來解釋,我猜你可以想起它 – 2010-09-20 16:49:20