MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
(Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: 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"; } }); }")
 
No edit summary
Line 9: Line 9:
     this.classList.toggle("active");
     this.classList.toggle("active");
     var content = this.nextElementSibling;
     var content = this.nextElementSibling;
     if (content.style.display === "block") {
     $(content).toggle('slow');
      content.style.display = "none";
    } else {
      content.style.display = "block";
    }
   });
   });
}
}

Revision as of 17:01, 9 October 2023

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


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;
    $(content).toggle('slow');
  });
}