私は、仮想的に多くの要素の間に挟まれ、サイドバーにある div を持っています。div とその下の要素の間にどれだけのスペースがあるかを計算する必要があります。次に、div の max-height を現在の高さとその下のスペースに設定して、それを超えて拡張しないようにします (したがって、ページを拡張します)。初期の最大高さは非常に小さい値であり、JS によって変更する必要があります。だから基本的に:
<thing></thing>
<div id="mydiv"></div>
<another></another>
そして、私は(jQueryの例)のようなものが必要です:
var spacebelow = space between mydiv and <another>
var daheight = (currentheight + spacebelow);
$("#mydiv").attr("style", "max-height:" + daheight + "px");
とにかくこれを行うことはありますか?