我真的很喜歡這個幫助......我正在爲投資組合項目構建一個濾鏡框。在if語句中匹配href類與div類
我有四個鏈接,每個都有一個類名,與他們的文本相同。所有投資組合項目都列出。每個投資組合項目都有一個div,其中包含兩個類 - .listItem和其中一個鏈接類。
例子:<a class="Architecture" href="#">
我想動畫上單擊DIV是:<div class="listItem Architecture">
這是我的腳本,it's不工作...
$(document).ready(function(){
var filterTrig = $('#sortPort a').attr('class');
$('#sortPort a').click(function() {
$('.listItem').each(function(){
if ($(this).is(filterTrig)){
$(this).hide();
}
});
return false;
});
});
jQuery不是「不可能的」。 –
你可以請澄清 - 你想隱藏div與匹配的類名或隱藏所有其他? – Mottie