gpt4 book ai didi

javascript - 如何定位底部菜单,使其在不同屏幕尺寸下都位于页面底部上方?

转载 作者:行者123 更新时间:2023-11-28 05:49:21 25 4
gpt4 key购买 nike

我正在努力定位我的菜单,以便它始终在不同尺寸的显示器上保持相同的位置,但在窗口大小减小和增大时也能响应。我绝对不是 CSS 专家,也没有接受过培训,所以我知道我的代码很糟糕。我也试图让菜单逐渐变得轻松,但不确定在哪里输入此代码。非常感谢任何帮助。

.HomeBottomMenu {

-webkit-font-smoothing:antialiased;
text-align: center;
text-align: justify;
position: absolute;
bottom: -3em;
}
.HomeBottomMenu ul {

list-style-type: none;
margin: 0;
padding: 0
}

.HomeBottomMenu ul li{

position: relative;
line-height: 21px;
min-width: 220px;
text-align: center;
background: #424242;
}

.HomeBottomMenu ul li a{

display: block;
padding: 8px 8px;
color: #fff;
text-decoration:none;
text-align: left;
font-family: 'BebasNeueRegular', Arial, sans-serif;
font-size: 18px;
font-weight: bold;
}
.HomeBottomMenu ul li a:hover{

color: #fff;
background: #25a0da;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}

.HomeBottomMenu ul li ul.dropdown{

background: #f2f2f2;
display: none;
position: absolute;
z-index: 999;
left: -0.01em;

}
.HomeBottomMenu ul li:hover ul.dropdown{

display: inline;
bottom: 100%;
position: absolute;
background: #939393;
min-height: 50px;
}


.HomeBottomMenu ul li ul.dropdowndropdown {

position: relative;
overflow:hidden;
z-index: 100;
height:0;
transition-property: height;
transition-duration: 0.5s;
transition-timing-function: linear;
transition-delay: 0.5s;
Opacity:1;
}

.HomeBottomMenu ul li ul :hover .dropdowndropdown{

position: relative;
display:inline;
bottom:100%;
height: 200px;
Opacity:1;
}

.HomeBottomMenu ul li ul.dropdowndropdown li{

display: block;
background-color: rgba(0, 90, 235, 0.33);
bottom: 100%;
}
.HomeBottomMenu ul li ul.dropdowndropdown li:hover{

position: relative;
}

.HomeBottomMenu ul li ul.dropdowndropdown li a{

color:#fff;
font-size:16px;
padding: 10px 10px;
text-align:center;
}

.HomeBottomMenu ul li ul .dropdowndropdown li a :hover{

color: #fff;
}

最佳答案

Got it working with:

<script type="text/javascript">
$(window).scroll(function() {
if ($(this).scrollTop() > 90) {
$('.HomeBottomMenu').fadeOut(100);
} else {
$('.HomeBottomMenu').fadeIn();
}
});
</script>

Many thanks for your help.

来自Andy Thomson

关于javascript - 如何定位底部菜单,使其在不同屏幕尺寸下都位于页面底部上方?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37435690/

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