jQuery队列函数只执行一次
在执行animated.css动画后,如何将元素返回到其位置? 我使用了这段代码,但它只执行了一次,下一次并没有删除类jQuery队列函数只执行一次,jquery,css,Jquery,Css,在执行animated.css动画后,如何将元素返回到其位置? 我使用了这段代码,但它只执行了一次,下一次并没有删除类 $(".stitch") .hover( function () { $(this).addClass("animated hinge"); } ) .delay( 5000 ) .queue( function () { $(this).removeClass("animated hinge").dequeue(
$(".stitch")
.hover( function () {
$(this).addClass("animated hinge");
} )
.delay( 5000 )
.queue( function () {
$(this).removeClass("animated hinge").dequeue();
} );
我试着下一个和下一个排队,但没有工作。
提前感谢您的帮助。如果您希望在动画完成后删除动画类,您可以使用文档中提供的简单jQuery插件代码
$.fn.extend({
animateCss:函数(animationName){
var animationEnd='webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationEnd';
this.addClass('animated'+animationName).one(animationEnd,function(){
$(this.removeClass('animated'+animationName);
});
}
});
var$me=$(“#me”);
$me.hover(函数(){
$me.animateCss(‘铰链’);
} );代码>
@导入url('https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css' );代码>
您好
您是否希望在动画完成后删除该类?是的,第二次未删除该类,我还将alert and queue didnt executeAnimate.css在其文档中提供了解决方案,我已在我的答案中发布了该解决方案。谢谢hungerstar:x