例如,我为我的投资组合做了一个过滤器,以便你可以点击“网络设计 ” ( Web Development), 它会从未标出其标记的 divs 中消失。 问题是我在“ #content” 中有一些我不想触碰的Divs 房屋。
$(document).ready(function() {
$( #filternav a ).click(function() {
$( #filternav .current ).removeClass( current );
$(this).parent().addClass( current );
var filterVal = $(this).text().toLowerCase().replace( , - );
if(filterVal == view-all ) {
$( #content div.hidden ).fadeIn( slow ).removeClass( hidden );
} else {
$( #content div ).each(function() {
if(!$(this).hasClass(filterVal)) {
$(this).fadeOut( normal ).addClass( hidden );
} else {
$(this).fadeIn( slow ).removeClass( hidden );
}
});
}
return false;
});
});
I want to add something do that line #content div . each(function) that will exclude things with the class "title." I think it should be as simple as an if statement, but I must be doing something wrong, and I m very new to jQuery so I m not sure what this syntax should be. Thanks.