2012-09-06 51 views
0

我想使用CSS3和jquery悬停一些图标。反弹动画附加到样式表中的.bounce类;为了处理悬停,我告诉Jquery在鼠标进入和离开图像的父元素时分别添加和删除bounce类。虽然jquery按预期工作,但动画不是,我不知道为什么。使用jQuery悬停触发CSS3动画不起作用

Here's the fiddle.我很感激帮助。

+0

如果你想更进一步:http://stackoverflow.com/questions/12062818/how-to-combine-jquery-animate-with-css3-properties-without-using-css-transitions –

回答

3

你错过了动画持续时间:

.bounce {  
    // this is the shorthand definition 
    -webkit-animation: bounce 1s ease infinite; 
    -moz-animation: bounce 1s ease infinite; 
    -o-animation: bounce 1s ease infinite; 
    animation: bounce 1s ease infinite; 
} 

http://jsfiddle.net/fyTpV/2/

+0

他正在使用别人的css我认为。 Animated类具有这些值。它只需要放在elem上进行动画制作。 –

+0

这样做!非常感谢。我假设为我生成的CSS表格已经包含在其中。我以前从未使用过CSS3动画,所以我甚至都没有想过要检查它。 –

0

您需要添加动画类。这里是更新的小提琴http://jsfiddle.net/fyTpV/3/添加类到你想要动画的elem中,或者在你的添加类中添加动画类。