Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

88
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!