1jQuery(document).ready(function($) {
2 $('#menu-links li a').click(function() {
3 //fetch the class of the clicked item
4 var clickedClass = $(this).attr('class');
5 //reset the active class on all the buttons
6 $('#menu-links li').removeClass('active');
7 //update the state on the clicked button
8 $(this).parent().addClass('active');
9 if (clickedClass == 'all') {
10 // show all our items
11 $('#menu-items').children('div.col-md-4').show();
12 } else {
13 //hide all elements that don't share clickedClass
14 $('#menu-items').children('div:not(.' + clickedClass + ')').hide();
15 //show all elements that do share clickedClass
16 $('#menu-items').children('div(.' + clickedClass + ')').show();
17 }
18 return false;
19 });
20});