Open Accordion From Different Page

Hi There

Currently, I have a functionality built on this page: (http://www.gilbertsondavis.com/ontario-arbitrators-mediators/), where if you click one of the buttons at the top of the header (John, Lee, David) etc, it moves you down the page and opens the corresponding accordion.

I would like this functionality to happen if I link it from another page. Currently, if I insert the link with the anchor (take David as an example), it directs me to the right section, but does not open the accordion. What do I need to modify for that to happen?

Thank you

Hi there,

Please consider that your request is considered as a customization and our theme does not have the feature out of the box and this is outside of our support scope. We can give you a code suggestion to build your customization over but we will not be able to implement the feature nor continue to support in the future if teh code breaks due to future updates to the theme and possible changes to the accordion element.

Having said that, please add the Javascript code below Appearance > Customize > Additional CSS to:


jQuery(document).ready(function($) {
	$('.open_accordion.x-btn').click(function(e) {
		
		var $this = $(this);
		var thisHref = $this.attr('href');
		var accordion = $(thisHref).find('.x-accordion-toggle');

		if ( accordion.length && $(thisHref).hasClass('x-accordion-group') ) {
			e.preventDefault();

			accordion.trigger('click');
		}

	});
	var uri= window.location.href;
	var result = uri.split("/").pop();
	if (result.indexOf('#') >= 0) {
		setTimeout(function(){$('.open_accordion[href="' + result + '"]').trigger('click');}, 100);
	}
});    

Thank you.

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