13 lines
406 B
JavaScript
13 lines
406 B
JavaScript
var coll = document.getElementsByClassName("collapsible");
|
|
var i;
|
|
for (i = 0; i < coll.length; i++) {
|
|
coll[i].addEventListener("click", function() {
|
|
this.classList.toggle("active");
|
|
var details = this.nextElementSibling;
|
|
if (details.style.maxHeight){
|
|
details.style.maxHeight = null;
|
|
} else {
|
|
details.style.maxHeight = details.scrollHeight + "px";
|
|
}
|
|
});
|
|
} |