Логика работы примерно такая:
<div class="controll">
<button type="button" data-value="all">All</button>
<button type="button" data-value="books">Books</button>
<button type="button" data-value="film">Film</button>
<button type="button" data-value="music">Music</button>
</div>
<div class="box">
<div class="item" data-value="books">
Books
</div>
<div class="item" data-value="film">
Film
</div>
<div class="item" data-value="music">
Music
</div>
<div class="item" data-value="books">
Books
</div>
<div class="item" data-value="film">
Film
</div>
</div>
(function($) {
'use strict';
$('button', $('.controll')).on('click', function(event) {
event.preventDefault();
var value = $(this).data('value');
if (value === 'all') {
$('.item', $('.box')).fadeIn(300);
} else {
$('.item[data-value!="'+ value +'"]', $('.box')).hide();
$('.item[data-value="'+ value +'"]', $('.box')).fadeIn(300);
}
});
})(jQuery);
Посмотреть пример на
codepen