MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus e-vendo Wiki
Wechseln zu: Navigation, Suche
Zeile 4: Zeile 4:
 
document.getElementById("btt").addEventListener("mouseenter",function(){ this.style.opacity="1.0", this.style.transition="0.5s" });
 
document.getElementById("btt").addEventListener("mouseenter",function(){ this.style.opacity="1.0", this.style.transition="0.5s" });
 
document.getElementById("btt").addEventListener("mouseleave",function(){ this.style.opacity="0.7", this.style.transition="0.5s" });
 
document.getElementById("btt").addEventListener("mouseleave",function(){ this.style.opacity="0.7", this.style.transition="0.5s" });
 +
 +
 +
var acc = document.getElementsByClassName("accordion");
 +
var i;
 +
 +
for (i = 0; i < acc.length; i++) {
 +
    acc[i].addEventListener("click", function() {
 +
        /* Toggle between adding and removing the "active" class,
 +
        to highlight the button that controls the panel */
 +
        this.classList.toggle("active");
 +
 +
        /* Toggle between hiding and showing the active panel */
 +
        var panel = this.nextElementSibling;
 +
        if (panel.style.display === "block") {
 +
            panel.style.display = "none";
 +
        } else {
 +
            panel.style.display = "block";
 +
        }
 +
    });
 +
}

Version vom 1. Juni 2018, 15:48 Uhr

/* Das folgende JavaScript wird für alle Benutzer geladen. */

/* back to top-button */
document.getElementById("btt").addEventListener("mouseenter",function(){ this.style.opacity="1.0", this.style.transition="0.5s" });
document.getElementById("btt").addEventListener("mouseleave",function(){ this.style.opacity="0.7", this.style.transition="0.5s" });


var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
    acc[i].addEventListener("click", function() {
        /* Toggle between adding and removing the "active" class,
        to highlight the button that controls the panel */
        this.classList.toggle("active");

        /* Toggle between hiding and showing the active panel */
        var panel = this.nextElementSibling;
        if (panel.style.display === "block") {
            panel.style.display = "none";
        } else {
            panel.style.display = "block";
        }
    });
}