MediaWiki:Common.js: Difference between revisions

From Nightlife Asia Wiki
Jump to navigation Jump to search
(Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: →‎Implementing JavaScript for Interactivity: document.addEventListener('DOMContentLoaded', function() { var collapsibles = document.querySelectorAll('.collapsible'); collapsibles.forEach(function(collapsible) { collapsible.addEventListener('click', function() { this.classList.toggle('collapsed'); var content = this.nextElementSibling; if (con...")
 
No edit summary
Tag: Manual revert
 
(4 intermediate revisions by the same user not shown)
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. */
/* Implementing JavaScript for Interactivity */
document.addEventListener('DOMContentLoaded', function() {
    var collapsibles = document.querySelectorAll('.collapsible');
    collapsibles.forEach(function(collapsible) {
        collapsible.addEventListener('click', function() {
            this.classList.toggle('collapsed');
            var content = this.nextElementSibling;
            if (content.style.display === "block") {
                content.style.display = "none";
            } else {
                content.style.display = "block";
            }
        });
    });
});

Latest revision as of 07:33, 27 September 2024

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