Boa tarde,
Estou fazendo uma Navbar mobile, usei um transform: translateX(100%) com position: absolute na tag ul para ela se posicionar fora da tela, e usei um overflow-x: hidden no body para esconder a tag ul enquando ela não for chamada. Porém a barra de scroll horizontal contia aparecendo. Alguem tem alguma ideia do que pode ser? Segue o Código abaixo. HTML
<header>
<nav>
<div>
<h1>LOGO</h1>
</div>
<div id='botao' className='menu-mobile'>
<div className={navBar ? 'linha-1' : 'linha-1-active'}></div>
<div className={navBar ? 'linha-2' : 'linha-2-active'}></div>
<div className={navBar ? 'linha-3' : 'linha-3-active'}></div>
</div>
<ul className={navBar ? 'navbar-mobile' : 'navbar-mobile-active'}>
<li>HOME</li>
<li>NÓS</li>
<li>CONTATO</li>
<li>PARA EMPRESAS</li>
</ul>
<a href='/'>Cadastrar</a>
</nav>
</header>
CSS
nav {
display: flex;
justify-content: space-around;
align-items: center;
height: 8vh;
}
h1 {
color: white;
}
.menu-mobile div {
display: none;
}
.linha-1-active{
transform: rotate(-45deg) translate(-8px, 8px);
}
.linha-2-active{
opacity: 0;
}
.linha-3-active{
transform: rotate(45deg) translate(-5px, -7px);
}
ul {
list-style: none;
display: flex;
}
li {
color: white;
margin-left: 2rem;
cursor: pointer;
}
li:hover {
color: var(--cinza-1);
}
a {
padding: 10px;
background-color: var(--verder-1);
text-decoration: none;
color: black;
border-radius: 30px;
transition: all ease 0.3s;
}
a:hover {
background-color: var(--verder-2);
}
@media screen and (max-width: 999px) {
body{
overflow-x: hidden;
}
a {
display: none;
}
.navbar-mobile {
position: absolute;
right: 0;
top: 8vh;
background-color: #4f4f50;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
height: 92vh;
width: 50vw;
transform: translateX(100%);
transition: all ease 0.3s;
}
.navbar-mobile-active{
position: absolute;
right: 0;
top: 8vh;
background-color: #4f4f50;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
height: 92vh;
width: 50vw;
transform: translateX(0);
transition: all ease 0.3s
}
li {
margin-left: 0;
}
.menu-mobile div {
display: block;
cursor: pointer;
width: 32px;
height: 2px;
background: #fff;
margin: 8px;
transition: 0.3s;
}
}