gpt4 book ai didi

javascript - jquery if 语句检测到高度

转载 作者:行者123 更新时间:2023-12-02 14:55:31 26 4
gpt4 key购买 nike

我正在尝试更改 h1 的填充,通过检测页面的高度,如果我的屏幕高度在 700:800 px 但我的代码无法正常工作:(

if ($('.background-wrapper').height() <= 800 && $('.background-wrapper').height() >= 700) {
$(".login > background-wrapper > h1").css("padding-top", "50px")
}

HTML:

<div class="background-wrapper">
<div class="container">
<div class="row">
<h1> CRM INTERACTIVE MAP SYSTEM</h1>
</div>
</div>
</div>

最佳答案

使用 CSS 媒体查询进行制作

@media only screen and (min-height: 700px) and (max-heigth: 800px) {
.login > background-wrapper > h1 {
padding-top: 50px;
}
}

关于javascript - jquery if 语句检测到高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35847778/

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