我试图做一个3阶段的动画,其中打开框最小化,他们都向左滑动,并单击框扩展。最后的动画,选中的方框展开,当它被称为第二个动画的参数时重复3次,但如果我单独调用它,它会正常工作。jQuery animate()重复3x
其在http://st-catherineschool.org/xbox/
$("#box2").click(
function(){
box = 2;
if(boxopen==box)return;
$("#box"+boxopen).animate({height:"-=30%", width:"-=10%", top:"+=20%", fontSize:"14px"}, 500, null,
function(){
$("section").animate({right:"+=25%"},500,null,
function(){
$("#box"+box).animate({height:"+=30%", width:"+=10%", top:"-=20%"}, 500);
$("#box"+boxopen).css("z-index", "8");
$("#box"+box).css("z-level", "9");
boxopen = box;
});
});
});
这不是停止动画的问题,它是DOM Bubbling的一个问题! – RobertPitt
添加.stop()没有改变,我不认为它的冒泡,因为答案1也没有帮助。 – austin
我的不好,你是对的,你只是把它与你的例子中的错误选择器。当我把它放在(“#box”+ box)中时,AKA#box2在最后一个函数中,它的工作原理就是我想要的。 – austin