2011-12-28 6 views
1

http://www.tigerstudiodesign.com/blog/jQueryの試合の高さは十分に

速くない時々マッチ高さは、あなたが別のページに移動するためのリンクをクリックしてください場合は特に、十分な速さではありません。私がリフレッシュしない限り、高さはお互いに一致しません。私は高さを一致させるために使用

コード:

function matchColHeights(col1, col2) { 
    $('img').load(function() { //let images load before I get the height, else height is calculated based on text alone 
    var col1Height = $(col1).height(); 
    //alert('col1: '+col1Height); 
     var col2Height = $(col2).height(); 
     //alert('col2: '+col2Height); 
     if (col1Height < col2Height) { 
     $(col1).height(col2Height); 
     } else { 
     $(col2).height(col1Height); 
     } 
    }); 
} 

$(document).ready(function() { 
    matchColHeights('#leftPanel', '#rightPanel'); 
}); 

任意のアイデア?

+1

あなたは詳しく説明できますか?どのコードが機能していないのですか? – gotofritz

+0

高さは単純に十分に速く一致しません。 #leftPanelと#rightPanelの高さが一致しない場合があります。ブラウザが続行できないためです。 – Lukasz

+0

さて、CSSスタイルの可視性を使用してください:両方またはそのコンテナに隠されていて、一度だけ「可視」に切り替えるか、切り替えることができます。 –

答えて

関連する問題