My webpage has a layout with multiple collapsible divs, followed by another set of divs underneath them.
Currently, as demonstrated in the provided example, only clicking on box 3 or box 1 (the left column) triggers the bottom div to scroll down.
I am attempting to enable scrolling for the right column (boxes 2 and 4) similar to the left column, but I am encountering difficulties in achieving this functionality.
Thank you in advance for any assistance.
var drop = document.getElementsByClassName("drop");
var i;
for (i = 0; i < drop.length; i++) {
drop[i].addEventListener("click", function() {
this.classList.toggle("active");
var collapse = this.previousElementSibling;
if (collapse.style.maxHeight) {
collapse.style.maxHeight = null;
} else {
collapse.style.maxHeight = collapse.scrollHeight + "px";
}
});
}
#panel{
background-color: white;
float: center;
position: relative;
width: 800px;
margin: 0 auto;
border-color: #B7B7B7;
border-width: 2px;
border-radius: 25px;
}
#box1{
...
<div id=panel>
<div id="box1">
...
</div>