Open accordion from image link

I am attempting to open an accordion using a link on an image. I have followed the steps listed here https://theme.co/apex/forum/t/link-to-specific-accordion-on-different-page/5302/10. The link moves to the accordion but does not open it.

The page link is https://homefiresprinkler.org/built-for-life-community/.

I’m using X theme and everything is fully updated.

Thanks

Hi mclukens,

That’s the extra code snippet you need to achieve that:

jQuery(document).ready(function($) {
  $('a[href^="#accordion-"]').each(function() {
    $(this).on("click", function(){
      event.preventDefault(); 
      var number = this.href.split('-').pop();
      $('#accordion-'+number+' .x-accordion-heading a').click();
    }); 
  });
});

Thanks.

Thanks. That works perfectly.

You are more than welcome! I’m glad it helped :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.