Open first item doesn't work when accordion is nested in article tag
-
When I nest the accordion within a article tag, then the option ‘open first’ doesn’t work. If I remove the article tag then it works.
I’m using your code within a loop:
`
<?php if(have_posts()): while(have_posts()):the_post();?>
<article>
<h3 class=”accordion-title”><?php the_title();?></h3>
<div class=”accordion-content”>
<?php the_content();?>
</div>
</article>
<?php endwhile;endif;?><!– End Loop –>!function(o){"use strict";var e=o(".accordion-title"),s=o(".accordion-content").hide(),n=o(".accordion-content:first-of-type"),t=250,i={autoClose:!0,openFirst:!0,openAll:!1,clickToClose:!0,scroll:!1};"undefined"!=typeof accordionSettings&&(i=accordionSettings),i.openAll?(s.show(),e.addClass("open")):i.openFirst&&(n.prev().addClass("open"),n.slideDown(t)),e.click(function(){return o(this).hasClass("open")?i.clickToClose&&(o(this).next().slideUp(t),o(this).removeClass("open")):(i.autoClose&&(s.slideUp(t),e.removeClass("open")),o(this).next().slideDown(t,function(){i.scroll&&o("html, body").animate({scrollTop:o(this).prev().offset().top},t)}),o(this).addClass("open")),!1})}(jQuery);
- The topic ‘Open first item doesn't work when accordion is nested in article tag’ is closed to new replies.