【发布时间】:2013-07-04 10:37:13
【问题描述】:
$(".test").bind("webkitAnimationEnd MSAnimationEnd OAnimationEnd animationEnd", function () {
$(this).removeClass("animate");
});
$(".test").hover(function () {
$(this).addClass("animate");
});
当您将鼠标悬停在 .test 元素上时,它会添加一个触发动画的 animate 类。在动画结束时,animate 类被 animationEnd 删除。
但是,如果您将鼠标悬停在动画上直到完成,然后在动画完成后取消悬停,则会添加另一个 animate 类...在取消悬停时再次触发动画。我不想要这个。
如何制作 jQuery,以便当您取消悬停时,它不会向 .test 元素添加另一个 animate 类?
另外... FireFox 没有删除animationEnd 的animate 类,这是为什么呢?
【问题讨论】:
标签: jquery animation jquery-animate