ここにjsfiddleがあります
ここにHTMLがあります
<div class="labels">
<span id="all" class="label active">All</span>
<span id="photoshop" class="label">Photoshop</span>
<span id="games" class="label">Games</span>
</div>
<div id="container">
<div class="photoshop"></div>
<div class="games"></div>
<div class="photoshop"></div>
<div class="games"></div>
<div class="photoshop"></div>
<div class="games"></div>
</div>
CSS
.label.active {
background-color: #4EB478;
font-size: 14px;
color: #fff;
}
.label {
cursor: pointer;
display: inline-block;
padding: .25em .6em;
font-weight: 500;
line-height: 1;
color: #4EB478;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
margin-bottom: 10px;
}
.container {
display: block;
}
.photoshop {
display: inline-block;
width: 100px;
height: 100px;
background: #321;
}
.games {
display: inline-block;
width: 100px;
height: 100px;
background: #789;
}
そしてJavaScript
$("#all").click(function(){
$("#container div").show();
})
$("#webdesign").click(function(){
$(this).siblings().removeClass("active");
$(this).addClass('active');
$("#container div").hide();
$('.webd').show();
})
$("#photoshop").click(function(){
$(this).siblings().removeClass("active");
$(this).addClass('active');
$("#container div").hide();
$('.photoshop').show();
})
$("#games").click(function(){
$(this).siblings().removeClass("active");
$(this).addClass('active');
$("#container div").hide();
$('.games').show();
})