Jquery 如何在animate.css库中使用悬停?

Jquery 如何在animate.css库中使用悬停?,jquery,html,css,css-animations,Jquery,Html,Css,Css Animations,我在一个页面中有许多类似的元素 <?php for($i=0;$i<100;$i++):?> <div class="parent"> <span class="child"></span> </div> <?php endif;?> 我想这样做是因为我想使用animate.css库 我想添加带有悬停的动画类。尝试: $( "div.psrent" ).hover(functio

我在一个页面中有许多类似的元素

<?php for($i=0;$i<100;$i++):?>
     <div class="parent">
        <span class="child"></span>
     </div>
<?php endif;?>

我想这样做是因为我想使用animate.css库

我想添加带有悬停的动画类。

尝试:

$( "div.psrent" ).hover(function() {
 $(this).find("span").addClass('childClass').removeClass('oldClass');//If you want to change span class inside div
 $(this).addClass('childClass').removeClass('oldClass');//If you want to change div class .if you dont want to remove old class just skip removeClass
});
别忘了把代码放在里面:

$( document ).ready(function() {

});
我使用了JQuery文档中的.hover()函数。 我没有动态生成列表项,但想法是一样的:

  • 选择悬停的“父”元素
  • 当 鼠标输入“父”元素
  • 鼠标离开时将其移除 它
$('.parent')。悬停(
函数(){
$(this.addClass('blue');
},
函数(){
$(this.removeClass('blue');
}
);
.blue{
背景颜色:蓝色;
}

孩子1
孩子2
孩子2

请澄清您的具体问题或添加其他详细信息,以突出显示您所需的内容。就目前编写的内容而言,很难准确地说出您的要求。
$('.child').hover(function(){$(this.addClass('yourClass');},function(){$(this.removeClass('yourClass');})
$( document ).ready(function() {

});