.animate({width: "300"},300);
},function() {
$(this).stop()
.animate({height: "22"}, 200)
.animate({width: "60"},300);
});
(3)第2个参数(gotoEnd)可以用于让正在执行的动画直接到达结束时刻的状态,通常用于后一个动画需要基于前一个动画的末状态的情况,可以通过stop(false,true)这种方式来让当前动画直接到达末状态。
(4)两者结合起来stop(true,true),即停止当前动画并直接到达当前动画的末状态,并清空动画队列。
(5)注意,jQuery只能设置正在执行的动画的最终状态,而没有提供直接到达执行动画队列最终状态的方法。例如有一组动画:
$("div.content")
.animate({width: "300"}, 200)
.animate({height: "150"}, 300)
.animate({opacity: "0.2"}, 200);无论怎么设置stop()方法,均无法再改变”width”或者”height”时,将此<div>元素的末状态变成300*150大小,并且设置透明度为0.2。
温馨提示:
jQuery中的动画有show()、hide()、fadeIn()、fadeOut()、slideDown()、slideUp()、animate()等等。stop()方法对上述的动画都适用。










