Skip Navigation

[Gelöst] Set Accordion Default to Closed

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:
I would like Accordion tab in a layout. to be collapsed by default.

Solution:
You would need to remove the class "in" from the panel.

Go to: Toolset > Layouts CSS & JS, in the JavaScript editor you should be able to add the following to strip the 'in' class when the page loads. In this case it would be for any panels, but you have only one. If you had multiple panels you would need a more specific selector.

( function( $ ) {
    $( document ).ready( function(){
        $('.panel-collapse').removeClass('in');
        $('.panel-title > a').addClass('collapsed');
    });
})( jQuery );
This support ticket is created vor 7 Jahren, 2 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Dieses Thema enthält 2 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von markH-16 vor 7 Jahren, 1 Monat.

Assistiert von: Noman.

Author
Artikel
#575247

I added an Accordion to a Layout. I'm only using one panel and I would like it to be collapsed by default. Is there a way to set the panel to 'collapsed', rather than 'open'.

My Panel title is; "How this page was made." The idea is, I'm new to Toolset and I want to document how I do things, so I don't forget. This is my test site, so to speak. You can see it at the bottom of this page: versteckter Link

Or, can I use Access to display this bit of content only to certain roles? I'd want others to see the rest of the page, but only certain roles to see the instructions.

Thanks.

#575282

Noman
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Karachi (GMT+05:00)

Hi mark,

Thank you for contacting Toolset support.

1. Accordion to be collapsed by default, what you need to do is to remove the class "in" from the panel.

Go to: Toolset > Layouts CSS & JS, in the JavaScript editor you should be able to add the following to strip the 'in' class when the page loads. In this case it would be for any panels, but you have only one. If you had multiple panels you would need a more specific selector.

( function( $ ) {
    $( document ).ready( function(){
        $('.panel-collapse').removeClass('in');
        $('.panel-title > a').addClass('collapsed');
    });
})( jQuery );

2. For limiting read access to specific content, please use Access plugin and follow this doc:
https://toolset.com/documentation/user-guides/limiting-read-access-specific-content/

Download Access plugin form here:
https://toolset.com/download/toolset-access/

Thank you

#575336

Thanks Noman. I added the js. That works perfectly.