Skip Navigation

[Resuelto] Set Accordion Default to Closed

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

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 hace 7 años, 1 mes. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por markH-16 hace 7 años, 1 mes.

Asistido por: Noman.

Autor
Mensajes
#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: enlace oculto

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

Idiomas: Inglés (English )

Zona horaria: 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.