• Resolved Clayton Chase

    (@claytonchase)


    Is there a way to use another block as the element that opens and closes the accordion? I’ve set it the HTML anchor option but I’m trying to get clicking the same element to close the accordion. Or if there is a way to do this already that would be great.

    The main reason for this is because the trigger button is in a different row than the accordion content.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author philbuchanan

    (@philbuchanan)

    In theory (I haven’t actually tested this), you can trigger a click event on the opening element using Javascript. Something like:

    <button id="js-trigger">Open Accordion Item 123</button>
    
    const trigger = document.getElementById('js-trigger');
    const title = document.getElementById('at-123');
    
    trigger.addEventListener('click', function(event) {
    	event.preventDefault();
    	
    	title.click();
    });
    Thread Starter Clayton Chase

    (@claytonchase)

    That worked. Thank you I appreciate it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Open & Close’ is closed to new replies.