在第二个动画CSS之后隐藏div

时间:2013-11-07 17:53:05

标签: jquery css animation css-transitions

我的代码中有一点问题。我试图让我的文字在第二个动画之后消失,这是“div.textoe”中的第一个动画(页面上的输入文本),第二个动画是在“div.textoee”中。我想要做的是在第二个动画之后清除页面文本,但是在我的代码中没有发生,我做错了什么?

$(".textoe").on('animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd', function(){ 
    $('.textoe').addClass('textoee'); 
    $('.textoee').removeClass('textoe'); 
}); 
$(".textoee").on('animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd', function(){ 
    alert('Hide text');
});

http://jsfiddle.net/w55dN/1/

1 个答案:

答案 0 :(得分:0)

您需要使用事件委派,因为要在绑定中定位的类是动态添加的:

$(document).on('animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd', '.textoee' ,function(){ 
    alert('Hide text');
});
相关问题