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.