Default Accordion item

NimrodYanai
NimrodYanai

Hi all!

Is there a way to make a specific accordion item open by default?

 

Thanks!

Comments

  • thaen
    thaen
    Posts: 1,064

    The only thing that comes to mind is you can set the CSS on the div to be something like:


    #ui-accordion-1-panel-0 {
      display: block !important;
    }

    But that will basically keep the first panel "open" (aka visible) all the time ... even when you try to close it or open a different panel.  So, that's probably not what you wanted.  Otherwise you could just not put the first part in the accordion.

    I can't think of a way to do it without using JavaScript.

    Obsidian Portal Developer

  • NimrodYanai
    NimrodYanai
    Posts: 101

    Could this feature be developed? Just an HTML attribute, like a check box's "checked" for example.

  • thaen
    thaen
    Posts: 1,064

    I've added it to the list!

    Obsidian Portal Developer

  • thaen
    thaen
    Posts: 1,064 edited March 2022

    @NimrodYanai, I just added a new beta feature called Custom JavaScript, and I added you to the beta. 

    I posted a Community Forum topic about it.  After you Allow Custom JavaScript for yourself on your Campaign, you can add this JavaScript to your Campaign Settings -> Advanced -> Custom JavaScript.  This code will always open the top most section of all accordions in your Campaign.  (It's slightly different from what's in the help doc that I linked in the other post ... this is a little more efficient for this purpose.)  If you were wanting control of the panel to open to be more granular than always the top one, feel free to say.


    $( document ).on("accordioncreate", function( event, ui ) {
    $( event.target ).accordion("option", "active", 0);
    });

     

    Post edited by thaen on

    Obsidian Portal Developer

Sign In or Register to comment.

March 2024
Wrath of the Highborn

Read the feature post on the blog
Return to Obsidian Portal

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Discussions