Line 14: | Line 14: | ||
acc[i].addEventListener("click", function() { | acc[i].addEventListener("click", function() { | ||
this.classList.toggle("active"); | this.classList.toggle("active"); | ||
− | var | + | var panel = this.nextElementSibling; |
− | if ( | + | if (panel.style.maxHeight) { |
− | + | panel.style.maxHeight = null; | |
} else { | } else { | ||
− | + | panel.style.maxHeight = (panel.scrollHeight + "px"); | |
} | } | ||
}); | }); |
Revision as of 18:09, 1 October 2018