저는 웹 사이트에서 일하고 있습니다. 이제는 jQuery 동위 원소에 붙어 있습니다. jquery 동위 원소를 사용하여 div를 필터링하지만 어떻게 든 작동하지 않습니다.필터링을위한 jQuery 동위 원소
내 HTML :
<center><a href="" class="filter" rel="all">show all</a> | <a href="" class="filter" rel="green">green</a> | <a href="" class="filter" rel="blue">blue</a> | <a href="" class="filter" rel="pink">pink</a></center>
<br>
<div class="wrap">
<div class="box green"></div>
<div class="box blue"></div>
<div class="box pink"></div>
<div class="box blue"></div>
<div class="box pink"></div>
<div class="box green"></div>
<div class="box pink"></div>
<div class="box green"></div>
<div class="box blue"></div>
<div class="clear"></div>
</div>
내 CSS :
.wrap{
margin: auto;
width: 660px;
background: #ccc;
}
.clear{
clear: both;
}
.box{
float: left;
width: 200px;
height: 200px;
margin: 10px 10px;
}
.green{
background: green;
}
.blue{
background: blue;
}
.pink{
background: pink;
}
내 자바 스크립트 :
$(document).ready(function() {
$('.wrap').isotope({
itemSelector: '.box'
});
$('a.filter').click(function() {
var to_filter = $(this).attr('rel');
if(to_filter == 'all') {
$('.box').fadeIn();
} else {
$('.box').each(function() {
if($(this).hasClass(to_filter)) {
$(this).fadeIn();
} else {
$(this).fadeOut();
}
});
}
return false;
});
});
또는이 링크를 볼 수 있습니다 http://jsfiddle.net/wPdXF/
내 정확한 문제 : 필터 링크를 클릭 한 후가 , div의이
사람이 제발 도움이 될 수 있습니다 애니메이션/셔플하지 않는 이유는 무엇입니까? 당신은 jQuery의 숨기기에 내장 된 사용하고 있기 때문에 당신이로 실행하고있는 (곳 "필터"항목 있지만 위치를 변경하거나 재배치 애니메이션을하지 않습니다) 내 나쁜 영어
을가 예상 작품으로 – reinder
@reinder을? 아니오, 절대적으로 ......... 답장을 보내 주셔서 감사합니다 : D – user2074851
그러면 문제를 더 잘 설명해야합니다. jsfiddle을 열고 "녹색"을 누르면 녹색 상자 만 표시됩니다. 다른 모든 색상과 동일하고 "모두 표시"는 모든 상자를 보여줍니다. 무엇을 기대합니까? – reinder