Game-Jaming/Frontend/Javascript/Collapsible.js

14 lines
415 B
JavaScript
Raw Normal View History

2021-03-15 13:03:29 +00:00
var coll = document.getElementsByClassName("Collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("CollapsibleActive");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
}