2011-09-02 6 views
0

私はすべてを試しましたが、javascriptなしでは実現できません悪いレイアウト私のデザイナーは私に与えました!あなたは私が#contenuto後ろに適切であることをZインデックスと位置付け、絶対にする必要がありDIV #1 backgrボックスを持って見ることができるようにfunction equalHeight、適用する最小の高さを設定しますか?

(ページのコンテンツを保持しています!) #backgr-boxの拡張性の問題を解決するには#contenutoの内容がサイドバーよりも長い場合は、以下のコードがあります#barra-lateraleしかし、 :http://demo.liquidfactory.it/secondopolo/per-informarti

は、どのように私はdivのサイドバー#のバラ-lateraleの最小の高さの上にその計算を適用するにはJavaScriptを伝えることができます?

お願いします。どうぞ!

function equalHeight(group) { 
      tallest = 0; 
      group.each(function() { 
       thisHeight = $(this).height(); 
       if(thisHeight > tallest) { 
       tallest = thisHeight = $("#contenuto").height() - 380; 
       } 
      }); 
      group.height(tallest); 
     } 
     $(document).ready(function() { 
      equalHeight($(".column")); 
     }); 

答えて

0

問題は、このラインを持つ可能性があります:

tallest = thisHeight = $("#contenuto").height() - 380; 

現在、それが設定された両方の変数tallestとコンテンツ地域マイナス380個のピクセルの高さにthisHeight。それを変更します。

tallest = thisHeight; 

そして、それは最も高い1の高さにすべての列のサイズを変更します。

編集

// calculate the total height of the content are and sidebar 
var contentHeight = $("#contenuto").height(); 
var sidebarHeight = 0; 
$(".barra-laterale").each(function() { sidebarHeight += $(this).height(); }) 

if (sidebarHeight > contentHeight) { 
    $("#contenuto").height(sidebarHeight); 
} else { 
    // extend the last sidebar column to cover the difference between the 
    // height of the content and the sum of the sidebar heights 
    var lastSideBarHeight = $(".barra-laterale").last().height(); 
    var heightDifference = contentHeight - sidebarHeight; 
    $(".barra-laterale").last().height(lastSideBarHeight + heightDifference) 
} 
+0

こんにちはクリスとTomalak:あなたの右側の列は、実際にあなたが完全に別のタックをしたいことがあり、この場合の.barra-lateraleのクラスに複数の列で構成されているように見えます! ehps ..それは動作していないようです!しかし、一見をして、今はid#barra-lateraleを長いサイドバーに追加し、最初のサイドバーを固定された高さに保つことができると考えます。380px!これは私たちを助けることができますか?長いページ:http://demo.liquidfactory.it/secondopolo/bacheca/prova – user920218

関連する問題