Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

Move rest of website down when opening collapsible

$
0
0

I am creating a website with a hamburger menu. The submenu is expanded when clicking a button. Everything is working the way it should but when I expand the submenus the rest of the menu doesn't move down and things start to overlap. I want that if you expand the submenu, the rest of the menu moves down. How do I accomplish this? I reduced the problem to the minimum in this jsfiddle: https://jsfiddle.net/TheBB23/8nsuhjav/

Keep in mind that at the bottom of the jsfiddle is the following script:

<script>
var acc = document.getElementsByClassName("expandsubmenu");
var i;

for (i = 0; i < acc.length; i++) {
  acc[i].addEventListener("click", function() {
    this.classList.toggle("active");
    var panel = this.nextElementSibling;
    if (panel.style.display === "block") {
      panel.style.display = "none";
    } else {
      panel.style.display = "block";
    }
  });
}
</script>

I appreciate any help.


Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>