2013-07-08 38 views
0

我一直在使用jQuery Equal Column Heights來匹配我網站上的主要內容和側邊欄,沒有任何問題。更重要的是,我有一個成員目錄,其中每個人都有一個「更多信息」按鈕,使用toggle()來展開div並顯示更多信息。點擊時,我也會觸發equalHeightColumns()函數來調整展開的div的列。再次,這工作。jQuery Isotope打破了jQuery Equal Column Heights

我已自添加Isotope來篩選此會員目錄。它可以工作,但是當我點擊「更多信息」按鈕時,不再調用equalHeightColumns()函數。沒有錯誤出現。

我的切換(),equalHeightColumns()代碼:

$(document).delegate('.toggle', 'click', function(){ 

    // get the sibling node with class 'hidden-info' 
    var mysection = $(this).prev('.hidden-info'); 
    mysection.toggle('fast'); 
     $(this).html($(this).html() == '<td>LESS INFO</td>' ? '<td>MORE INFO</td>' : '<td>LESS INFO</td>'); 

    var fullbio = $(this).parent().parent().prev('.hidden-bio'); 
    fullbio.toggle(); 

    var partialbio = $(this).parent().parent().prev().prev('.hidden-bio'); 
    partialbio.toggle(); 

    if ($(window).innerWidth() > 800) { 
    $('#content, #sidebar, #content-sidebar-wrap').css('height' , 'auto'); 
    $("#content, #sidebar, #content-sidebar-wrap").equalHeightColumns(); 
    } 

    else { 
    $('#content, #sidebar, #content-sidebar-wrap').css('height' , 'auto'); 
    } 

}); 

我的同位素代碼:

$(window).load(function(){ 
var $container = $('.professionContainer'); 
$container.isotope({ 
    transformsEnabled: false, 
    filter: '*', 
    animationOptions: { 
     duration: 750, 
     easing: 'linear', 
     queue: false 
    } 
}); 

$('.professionFilter a').click(function(){ 
    $('.professionFilter .current').removeClass('current'); 
    $(this).addClass('current'); 

    var selector = $(this).attr('data-filter'); 
    $container.isotope({ 
     filter: selector, 
     animationOptions: { 
      duration: 750, 
      easing: 'linear', 
      queue: false 
     } 
    }); 
    return false; 
}); 
}); 

讓我知道如果你需要的任何其他信息。

謝謝。

編輯:我意識到,equalHeightColumns函數被解僱,如果我第二次點擊鏈接。

回答

0

我想通了:在調整列之前,我需要在切換條目之後展開同位素容器。所以在功能方面,我加

$container.isotope('reLayout'); 

調用.equalHeightColumns();