MediaWiki
Foreground.js: Difference between revisions
From Grouse House Wiki
No edit summary |
No edit summary |
||
| Line 6: | Line 6: | ||
for (i = 0; i < coll.length; i++) { | for (i = 0; i < coll.length; i++) { | ||
coll[i].addEventListener("click", function() { | coll[i].addEventListener("click", function() { | ||
var content = this.nextElementSibling; | var content = this.nextElementSibling; | ||
if (content.style.display === "block") { | if (content.style.display === "block") { | ||
content.style.display = "none"; | content.style.display = "none"; | ||
this.classList.setAttribute("id", "hidden"); | |||
} else { | } else { | ||
content.style.display = "block"; | content.style.display = "block"; | ||
Revision as of 01:01, 1 February 2024
/* Collapsible Headers */
var coll = document.getElementsByClassName("c-header");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
this.classList.setAttribute("id", "hidden");
} else {
content.style.display = "block";
coll.setAttribute("id", "active");
}
});
}
