MediaWiki:Common.js: Difference between revisions

From WikiMSK

No edit summary
No edit summary
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
$(document).ready(function(){
    $("h2").addClass("collapsible");
    $("p").addClass("content");
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.display === "block") {
      content.style.display = "none";
    } else {
      content.style.display = "block";
    }
  });
}
});

Revision as of 08:44, 22 August 2020

/* Any JavaScript here will be loaded for all users on every page load. */