How to configure the Elementor Accordion/Sanfona to start closed

The accordion widget in Elementor is configured to remain open and there is no native option to keep it closed. However, you can easily close them using a simple JavaScript script.

Elementor has an Accordion / Sanfona widget feature that is a great resource for creating FAQ or similar sessions. Using the Accordion widget, you can add an unlimited number of items. This can be somewhat inconvenient for some users, as the main purpose of adding an accordion is to hide information, requiring user interaction (such as clicking on an accordion item) to reveal the information.

So how do I set all the accordion items to be closed by default? Simple, apply the following JavaScript code anywhere on your page or site, such as the header or footer. You can also insert it into an HTML widget in Elementor itself

<script>
jQuery(document).ready(function($) {
var delay = 100; setTimeout(function() {
$('.elementor-tab-title').removeClass('elementor-active');
 $('.elementor-tab-content').css('display', 'none'); }, delay);
});
</script>

If all goes well, you’ll see that your accordions will close, only showing the information when the user clicks on the desired item.

See you later.

Anúncio
Categorias

Leave a Comment

Your email address will not be published. Required fields are marked *