gpt4 book ai didi

javascript - jQuery 和 CSS 最小高度 :100%

转载 作者:行者123 更新时间:2023-11-28 07:01:45 25 4
gpt4 key购买 nike

我的 CSS:

body{
width:100%;
min-height:100%;
}

我的 JQ:

function abc(){
var h_1 = jQuery('.top_menu_container').height();
var h_2 = jQuery('.bottom_container').height();
var sum = h_1 + h_2;
var body_h = jQuery('body').height();

jQuery('.s1_container').css('height',( body_h - sum ) + 'px');
}

setInterval(abc,1000);

发生了什么……当“body”有 min-height:100%;当 body 有 overflow-y:visible 时,我将寡妇宽度更改为例如小于 767px,每个 setInterval 的 body 高度越来越大 - 它总结了较早的高度 + 当前高度。我需要 body 的最小高度,因为它有背景

最佳答案

如果只用vh呢? )

body {
min-height:100vh;
}

关于javascript - jQuery 和 CSS 最小高度 :100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33188115/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com