Accordion – jQuery

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

for (i = 0; i < acc.length; i++) {
  acc[i].addEventListener("click", function() {
    this.classList.toggle("active");
    var panel = this.nextElementSibling;
    if (panel.style.maxHeight) {
      panel.style.maxHeight = null;
      $(this).parent().addClass('active');
    } else {
      panel.style.maxHeight = panel.scrollHeight + "px";
      $(this).parent().removeClass('active');
    } 
  });
}

Search the site

Newsletter

Subscribe to get regular news and updates

  • This field is for validation purposes and should be left unchanged.