我嘗試在改變窗口位置時使用豐富的閃光效果,但存在一個小問題,我無法解決。setTimeout不適用於window.location?
看劇本請
$(document).ready(function(){
$('a.flash').click(function(e) {
e.preventDefault();
$('body').fadeOut(1500);
setTimeout("", 1500);
window.location=this.href;
});
});
window.location=this.href
必須1500毫秒後進行的,但它不會發生。你可以解釋爲什麼嗎? ? 奇怪的是,當我嘗試寫alert("something");
而不是window.location=this.href
,它工作正常。你能解釋爲什麼嗎?
感謝
爲什麼它在我寫alert()時工作?在這種情況下,它會「睡」1500毫秒,並在警報後。爲什麼? – Simon 2010-06-13 17:51:37