我有这样的:让jQuery等待一个.each函数在下一行执行之前完成?
$("a.fadeout").click(function(event){
event.preventDefault();
var loc = this.href;
//Do this first...
$($(".faded").get().reverse()).each(function(i) {
$(this).delay(i * 100).fadeOut();
});
//And only then do this..
window.location = loc;
});
如何强制fadeouts前的位置变化来完成?如果它只是一个fadeOut(),我会使用它的回调函数,但由于有很多,我无法弄清楚如何去做。
干杯! Ben
这里的问题不在'.each()'函数中,因为它会在下一行执行之前完成。它使用'.delay()'函数,延迟的时间比通过'.each()'函数运行并执行下一行所需的时间长。 – jtfairbank