libreshop_website/content/index/collaps.js

13 lines
406 B
JavaScript
Raw Permalink Normal View History

2023-08-02 19:20:38 +00:00
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";
}
});
}