2012-05-06 74 views
1
$('.comment').hide(2000); 

此淡入淡出类别注释后两秒。是否有一种简单的方法来防止类“评论”通过添加一个额外的类淡入淡出?Jquery类选择器和隐藏()

<div class="comment">This text hides</div> 
<div class="comment nohide">This text should not hide</div> 

添加nohide类并不妨碍它隐藏。我可能最终会创建一个新班级,但我想我会问。

+0

之前已经询问过:http://stackoverflow.com/questions/10466940/how-to-filter-undesired-elements-with-jquery/10466957#10466957 –

回答

0

如果可能的话,我会用

$('.comment.fadeable').hide(2000) 

。因为它通常看起来比“不”选项更直接。 $(".x.y").hide()仅适用于hide()以具有“x”和“y”类的div。