Difference between revisions of "Template:Virginia"

(Undo revision 404631 by Christiaaspili (talk))
Line 96: Line 96:
  
 
});
 
});
 +
 +
 +
/*********CHRISTIA'S SCRIPT**********/
 +
 +
var acc = document.getElementsByClassName("accordion");
 +
var i;
 +
 +
for (i = 0; i < acc.length; i++) {
 +
    acc[i].onclick = 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";
 +
        }
 +
    }
 +
}
 +
 +
 +
</script>
 +
 +
 +
 +
 +
 +
 +
<style>
 +
div.panel {
 +
    padding: 0 18px;
 +
    background-color: white;
 +
    max-height: 0;
 +
    overflow: hidden;
 +
    transition: max-height 0.2s ease-out;
 +
}
 +
</style>
 +
 +
<script>
 +
var acc = document.getElementsByClassName("accordion");
 +
var i;
 +
 +
for (i = 0; i < acc.length; i++) {
 +
  acc[i].onclick = function() {
 +
    this.classList.toggle("active");
 +
    var panel = this.nextElementSibling;
 +
    if (panel.style.maxHeight){
 +
      panel.style.maxHeight = null;
 +
    } else {
 +
      panel.style.maxHeight = panel.scrollHeight + "px";
 +
    }
 +
  }
 +
}
 +
</script>
  
 
<style>
 
<style>

Revision as of 04:03, 1 November 2017