• Resolved thinh94

    (@thinh94)


    Hello everyone,

    I was wondering if it’s possible to open stackable’s accordion after clicking an anchor/link.

    As an example:
    I have an accordion with a headline tag in it.
    I have a table of content that includes this headline tag.
    So the ToC has an ExampleHeadline on example-url.com/page.
    It brings me down to example-url.com/page/#ExampleHeadline.

    What do I have to do to make it open when I click on the ToC link?

    As a further level, which is not essential tho, can I even open an accordion block within an accordion block using such a method?

    Thank you for your help.
    Stay safe and healthy.


    Edit1: Added an example page.

    • This topic was modified 4 years, 8 months ago by thinh94.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor gambitph

    (@gambitph)

    Unfortunately, we don’t have this kind of feature.

    This sounds like a special case, you can try to add some custom JS code to unable the click event of the Accordion.

    Thread Starter thinh94

    (@thinh94)

    I got a solution! ??
    The creator of the ToC Plugin provided one which is working perfectly with the stackable accordion.

    (function($){
    	$(function(){
    		$('.lwptoc_item A').click(function(){
    			var $target = $($(this).attr('href'));
    			if ($target.length) {				
    				$target.parents('.ugb-accordion').each(function(){
    					var $this = $(this);
    					if (!$this.hasClass('ugb-accordion--open')) {
    						$this.addClass('ugb-accordion--open');
    					}
    				});
    			}
    		});
    	});
    })(jQuery);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Automatically toggle / open accordion block after clicking anchor / link’ is closed to new replies.