Make v2 button open v2 accordion on another page

when a button is clicked I want it to open an accordion on another page. I read the forum for hours and tried everything - but nothing works. I’m using the latest version of X and Cornerstone and all v2 elements. Also please note that the “relocation” button I referenced in the private note already has a class assigned to it. Please help

Hi there,

Thanks for writing in.

It’s just about URL of the button, hence, all you just need is a link in any button. Then add this code to your global custom javascript.

jQuery ( document ).ready( function($) {

setTimeout ( function() {

var hash = window.location.hash;

if ( hash == '' || hash == '#' ) return false;

$( hash + '.x-acc-header').trigger('click');


}, 500 );

} );

Then you have to change your button URL from #accordion-item-1 to #tab-e137-16. The #tab-e137-16 is the ID of the accordion button in which you can find when you inspect your page in browser developer tools (like chrome’s inspector)

Thanks!

That worked perfectly - thank you.

Now I need the accordions to be yellow vs white to match the buttons. Is there a way to do it so ALL accordions created in the future will automatically be yellow as well?

never mind on the color - i figured it out - thanks again!

Glad you’ve sorted it out.

Cheers!

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