現在、html 要素の高さを取得するためにいくつかの問題が発生しています。ウィンドウのサイズが変更されたときに更新されないようです。「height: auto」で html をリセットしようとしましたが、それは役に立たないようです。
幅は正常に機能しますが、高さは更新されません。
この問題の解決策はありますか?
前もって感謝します!
JQuery:
function UpdateLeftBar() {
// Reset
$('html').height('auto');
// Get the height of the window and minus the header and left top elements
height = $('html').height() - 85 - 56 + 29;
width = $('html').width() - 300;
// Set the div to the new height
$('#leftContentBottom').css({ 'height': height });
$('#middleContent.span10').css({ 'width': width });
console.log(height);
}
$(window).resize(function () {
UpdateLeftBar();
});
本当に奇妙なことに、80% の確率で更新されることに気付きましたが、ウィンドウをダブルクリックしてもサイズが変更されません。
修正: HTML の高さを取得する代わりに、ウィンドウの高さを取得する必要があります。これで問題が解決しました。