Schmidtchen (Talk | contribs) (Created page with "// Trying to minimize the impact that the fucking iGEM upload system has on the layout of the uploaded pages... Minimizing the impact of the already loaded stylesheet... $(do...") |
Schmidtchen (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | + | var coll = document.getElementsByClassName("collapsible"); | |
+ | var i; | ||
− | + | for (i = 0; i < coll.length; i++) { | |
− | + | coll[i].addEventListener("click", function() { | |
− | + | this.classList.toggle("activedropdown"); | |
− | + | var content = this.nextElementSibling; | |
− | + | if (content.style.maxHeight){ | |
− | + | content.style.maxHeight = null; | |
− | + | } else { | |
− | + | content.style.maxHeight = content.scrollHeight + "px"; | |
− | + | } | |
− | + | }); | |
− | } | + | } |
Latest revision as of 09:05, 12 September 2018
var coll = document.getElementsByClassName("collapsible"); var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() { this.classList.toggle("activedropdown"); var content = this.nextElementSibling; if (content.style.maxHeight){ content.style.maxHeight = null; } else { content.style.maxHeight = content.scrollHeight + "px"; } });
}