MediaWiki

Foreground.js: Difference between revisions

From Grouse House Wiki

No edit summary
Tag: Manual revert
No edit summary
Line 10: Line 10:
     if (content.style.display === "block") {
     if (content.style.display === "block") {
       content.style.display = "none";
       content.style.display = "none";
      coll.setAttribute("id", "hidden");
     } else {
     } else {
       content.style.display = "block";
       content.style.display = "block";
      coll.setAttribute("id", "active");
     }
     }
   });
   });
}
}

Revision as of 00:59, 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() {
    this.classList.toggle("active");
    var content = this.nextElementSibling;
    if (content.style.display === "block") {
      content.style.display = "none";
      coll.setAttribute("id", "hidden");
    } else {
      content.style.display = "block";
      coll.setAttribute("id", "active");
    }
  });
}