gpt4 book ai didi

html - 手机 : Hide menu and menu overlay after menu item is clicked

转载 作者:行者123 更新时间:2023-11-27 23:45:56 30 4
gpt4 key购买 nike

我正在为移动设备设置新菜单。一切都设置好了,但在我点击任何菜单项后,它并没有关闭菜单和菜单覆盖。

有什么办法解决这个问题吗?

我在下面提供了我的 CSS 和 HTML 代码。

CSS


margin-bottom:-7em;
}

@keyframes bugfix {
from {
padding: 0;
}
to {
padding: 0;
}
}
@-webkit-keyframes bugfix {
from {
padding: 0;
}
to {
padding: 0;
}
}
#overlay-button {
position: absolute;
right: 2em;
top: 3em;
padding: 26px 11px;
z-index: 5;
cursor: pointer;
user-select: none;
}
#overlay-button span {
height: 4px;
width: 35px;
border-radius: 2px;
background-color: white;
position: relative;
display: block;
transition: all 0.2s ease-in-out;
}
#overlay-button span:before {
top: -10px;
visibility: visible;
}
#overlay-button span:after {
top: 10px;
}
#overlay-button span:before, #overlay-button span:after {
height: 4px;
width: 35px;
border-radius: 2px;
background-color: white;
position: absolute;
content: "";
transition: all 0.2s ease-in-out;
}
#overlay-button:hover span, #overlay-button:hover span:before, #overlay-button:hover span:after {
background: #fff;
}

input[type="checkbox"] {
display: none;
}

input[type="checkbox"]:checked ~ #overlay {
visibility: visible;
}

input[type="checkbox"]:checked ~ #overlay-button:hover span,
input[type="checkbox"]:checked ~ #overlay-button span {
background: transparent;
}
input[type="checkbox"]:checked ~ #overlay-button span:before {
transform: rotate(45deg) translate(7px, 7px);
opacity: 1;
}
input[type="checkbox"]:checked ~ #overlay-button span:after {
transform: rotate(-45deg) translate(7px, -7px);
}

#overlay {
height: 190vh;
width: 100%;
background: #ec6451;
z-index: 2;
visibility: hidden;
position: fixed;
left:0;
top:0px;
}
#overlay.active {
visibility: visible;
}
#overlay ul {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
text-align: center;
height: 100vh;
padding-left: 0;
list-style: none!important;
}
#overlay ul li {
padding: 1em;
list-style: none;
margin-left:-4%;
}
#overlay ul li a {
color: white;
text-decoration: none;
font-size: 1.5em;
}
#overlay ul li a:hover {
color: #333332;

}

#overlay ul li a:click {
display:none;
background-color:transparent;
}

HTML

 <body>
<input type="checkbox" id="overlay-input" />
<label for="overlay-input" id="overlay-button"><span></span></label>
<div id="overlay" >
<center> <img src="/wp-content/uploads/2019/06/logo-copy.png" class="logo-up" alt="Trulli" width="250" height=auto></center>
<ul>

<li><a href="#home">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</body>

请看看我的问题。谢谢你的每一个答案。此代码已在平板电脑上测试过,尚未在移动设备上测试过。首先,我需要解决我的问题。

最佳答案

你必须设置 onclick Action 来关闭悬停

关于html - 手机 : Hide menu and menu overlay after menu item is clicked,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56818270/

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