Link to an open accordion item that is closed by default

Hi support. I have 29 accordion in five groups in this page https://lekamouraska.com/offres/nos-employeurs-partenaires-attendent-vos-cv/

I would like to have a link to go to a particular item with this accordion in the open state.

I have tried: https://theme.co/apex/forums/topic/links-to-open-accordion-tab/#post-1162373

The aim is to link a Facebook post with the accordion item.

Hi,

You can try this code instead.

Add this in Theme Options > JS

(function($){
  
    if(window.location.hash) {
      var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
     
   
       var navbar = $('.x-navbar').outerHeight();
       var adminbar = $('#wpadminbar').outerHeight();
       
    $('.x-accordion .x-accordion-body').removeClass('in');
    $('.x-accordion>'+hash + ' .x-accordion-toggle').trigger('click');

    setTimeout ( function() { //Let's trigger the scroll animation just after the content is displayed.
   
    var yloc = $(hash).offset().top+navbar+adminbar;

    $('html, body').animate({
        scrollTop: yloc
    }, 850, 'easeInOutExpo');

   }, 750 );
}
    
    
     });

Make sure to add a unique id to your accordion element

You can then link to it as https://lekamouraska.com/offres/nos-employeurs-partenaires-attendent-vos-cv/#my-accordion-1

As this is all custom development, regretfully we won’t be able to assist further. Custom development is outside the scope of our support. We are happy to provide advice and get you started in the right direction, but you would still be responsible for the implementation. If you are not comfortable making further changes and if you require more customization on your site, it would be best to get in touch with a developer.

Thank you for understanding

Hi Paul. Thank you but the code provided is not working. The page was made with a classic accordion element.

I replaced a section of the old classic accordion item with the new and it works perfectly. Thanks and close this ticket.

Have a good day @paul.r

Hey @philippe,

This feature was also made known and our development team is looking into the best method that this would work for the V2 Accordion. I’m not sure if this will be made possible for the Classic Accordion.

Regretfully, we could not provide an ETA.

Please stay tuned.

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