MediaWiki
Foreground.js: Difference between revisions
From Grouse House Wiki
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
if (content.style.display === "block") { | if (content.style.display === "block") { | ||
content.style.display = "none"; | content.style.display = "none"; | ||
this.classList. | this.classList.add("hidden"); | ||
} else { | } else { | ||
content.style.display = "block"; | content.style.display = "block"; | ||
this.classList.add("active"); | |||
} | } | ||
}); | }); | ||
} | } |
Revision as of 01:11, 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.add("hidden"); } else { content.style.display = "block"; this.classList.add("active"); } }); }