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

87
Visualizações
How to stop Javascript div opening from moving the contents around

Is there a way to stop the content of my div from moving around as it opens and closes? It looks really messy. When you click to open the div everything goes from one line to two lines to 3 lines etc. I just want it to open as it will display when fully open. I have included some screenshots to show what I mean.

This image showcases what the div looks like as it opens with everything stacked on top of each other.

enter image description here

This is the final result with everything where it should be, ideally I would like the div to open with everything staying as below.

enter image description here

This is the code I have:

<script>
function openNav() {
            var sidenav = document.getElementById("mySidenav");
            sidenav.classList.add("sidenavopen");
            sidenav.classList.remove("sidenavclose");
        }
        function closeNav() {
            var sidenav = document.getElementById("mySidenav");
            sidenav.classList.add("sidenavclose");
            sidenav.classList.remove("sidenavopen");
        }
</script>



<style>    
.sidenav .closebtn {
      position: absolute;
      top: 0px;
      left: 25px;
      font-size: 36px;
      margin-left: 50px;
    }
    
    @media screen and (max-height: 450px) {
      .sidenav {padding-top: 15px;}
      .sidenav a {font-size: 18px;}
    }
    
    .sidenavopen {
      width: 40%;
      @media (max-width: $breakpoint-mobile) {
        width: 100%;
      }
    }
    .sidenavclose {
      width: 0 !important;
    }
</style>
about 4 years ago · Juan Pablo Isaza
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