Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #31557

    Antonela D
    Participant

    Hi, I want to set the option of “expand all” and “close all” for the accordions.

    Thanks.

    #31558

    Antonela D
    Participant
    This reply has been marked as private.
    #31762

    Rad
    Moderator

    Hi Antonela,

    You could do this by adding this javascript under Customizer > Custom > Javascript .

    Let say you add expand and collapse all button at your editor

    <a href="#" class="expandall_accord">Expand All</a> | <a href="#" class="collapseall_accord">Collapse All</a>

    jQuery('.expandall_accord').on('click', function(){
    jQuery('.accordion-body').collapse('show');
    });
    
    jQuery('.collapseall_accord').on('click', function(){
    jQuery('.accordion-body').collapse('hide');
    });

    Hope this helps.

    #32038

    Antonela D
    Participant

    Thanks!

    #32134

    Alexander
    Keymaster

    You’re welcome! Take care

    #639291

    sndesign
    Participant

    Very helpful – thank you!

    #639368

    John Ezra
    Member

    You’re most welcome!

    #873088

    sndesign
    Participant
    This reply has been marked as private.
    #873853

    Rad
    Moderator

    Hi there,

    Please update your javascript code to this,

    jQuery ( function($) {
    $('.expandall_accord').on('click', function( e ){
    $('.x-accordion-body').collapse('show');
    e.preventDefault();
    });
    
    $('.collapseall_accord').on('click', function( e ){
    $('.x-accordion-body').collapse('hide');
    e.preventDefault();
    });
    } );

    Cheers!

    #874250

    sndesign
    Participant

    Thanks – that worked like a charm!

    #874810

    Christopher
    Moderator

    You’re welcome.