Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
Nav Element Disappears When Parents Element's Position Changed to Sticky

I have a navbar div that has a title and a nav component. When the window gets small enough I collapse the nav element so have a burger to show and hide the nav element. Without changing the position attribute of the parent navbar div it works fine, however when I make the parent navbar div sticky I can no longer see the navbar move over onto the screen. I toggle the navbarHidden and navbarVisible class on the child nav element when the burger is clicked.

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 8vh;
  border-bottom: 1px solid rgb(220, 220, 220);
  position: sticky;
  top: 0;
  background-color: white;
}

.navbar nav {
    position: absolute;
    right: 0px;
    top: 8vh;
    height: 92vh;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    padding-right: 0;
    font-size: 30px;
    width: 40%;
    background-color: antiquewhite;
    transition: transform 0.5s ease-in;
    z-index: 1;
  }

.navbarHidden {
    transform: translateX(100%);
  }

  .navbarVisible {
    transform: translateX(0);
  }

The nav element still shows up when you inspect the page though.

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I figured it out, all you had to do was change the position on the nav element to fixed instead of absolute.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda