我写过这样的jquery代码和html:
$("#bottom_images li").mouseenter(function() {
$(this).find("span").animate({bottom:0},500);
}).mouseleave(function(){
$(this).find("span").animate({bottom:-70},500);
});
<ul id="bottom_images">
<li class="img1 img_active"><span>Text</span></a>
<li class="img2"><span>Text</span></a>
....
</ul>
此代码工作正常(它在 li 元素内的 span 上创建 .animate 效果)。
但是对于 .img_active 类的 li 元素,我不需要这种效果。该元素有两个类 img1 和 img_active。我无法创建排除 li.img_active 的选择器。可能, :not 应该使用,但我有语法问题。