Hello,
I have completed this tutorial on 'Creating a “Filterable” Portfolio with jQuery' from nettuts+ and was wanting to tweek it a bit.
I would like to instead of clicking the top navigation and each category filters based on what was clicked, i want to click one 'Design' and if I click another 'CMS' they will show the items from both categories. When clicked again will turn that filter off and show whatever is selected.
so, in other words I want it to display what ever i select and I unselect by clicking the category again.
Below is the JS file I am using:
$(document).ready(function() {
$('ul#filter a').click(function() {
$(this).css('outline','none');
$('ul#filter .current').removeClass('current');
$(this).parent().addClass('current');
var filterVal = $(this).text().toLowerCase().replace(' ','-');
if(filterVal == 'all') {
$('ul#portfolio li.hidden').fadeIn('slow').removeClass('hidden');
} else {
$('ul#portfolio li').each(function() {
if(!$(this).hasClass(filterVal)) {
$(this).fadeOut('normal').addClass('hidden');
} else {
$(this).fadeIn('slow').removeClass('hidden');
}
});
}
return false;
});
});
Any help on this would be great. Thanks.