ページが読み込まれたときとウィンドウのサイズが変更されたときに、Webページ上のいくつかのdiv要素のサイズを変更するスクリプトを作成しました。問題は、クロムをウィンドウからフルスクリーンに変更すると(F11フルスクリーンモードが端から端まで移動するという意味ではありません)、divのごく一部が見えなくなることです。他のブラウザでは発生しません。Chromeの最新リリースを実行しています。
この問題が発生しているdivは#black_line_bottomであり、右下隅に#bottom_containerdivが表示されます。
サイズ変更(js)のコード:
function calcHeight(factor){
if($(window).height() > 720){
return $(window).height() * factor / 100;
}
else{
return 720 * factor / 100;
}
}
function getEl(x){
return document.getElementById(x)
}
function resizeHeight(){
var height = calcHeight(3.5);
getEl("black_line_bottom").style.height = height + "px";
getEl("white_line_bottom").style.bottom = height + "px";
height = calcHeight(7.8);
getEl("bottom_container").style.height = height + "px";
getEl("white_line_bottom").style.height = (height - calcHeight(3.5)) + "px";
height = calcHeight(20.5);
};
$(window).on( "resize ready" , resizeHeight);
html:
<body>
<div id = "bottom_container" >
<div id = "black_line_bottom" class = "black_line">
</div>
<div id = "white_line_bottom"class = "white_line">
</div>
</div>
</body>
css:
.black_line {
position : fixed;
background-color : #0a0a0a;
width : 100%;
height : 41px;
left : 0px;
right : 0px;
}
#black_line_bottom {
bottom : 0px;
}
#bottom_container {
position : fixed;
width : 100%;
height : 90px;
left : 0px;
right : 0px;
bottom : 0px;
}
.white_line {
position : absolute;
background-color : red;
width : 100%;
height : 100%;
left : 0px;
right : 0px;
}
#white_line_bottom {
bottom : 41px;
}