This repository has been archived on 2022-01-14. You can view files and clone it, but cannot push or open issues/pull-requests.
nwt/assets/js/collapsible.js

15 lines
392 B
JavaScript
Raw Normal View History

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