“How to close by default the accordion in Elementor”

It is very common for a client to ask you to “put” information on accordions. It is used a lot for SEO issues. The page has to have a certain number of words, but there is no way that so much text fits.

The problem is that, by default, in Elementor always the first tab of the accordion is open. And there are customers who hate this! It has a solution? Of course, if you simply paste the following code in an HTML section wherever you want:

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

There is nothing more to do. Easy, useful, just copy and paste We hope it serves

How to make the Elementor accordion close only on mobile

Some people ask me how to make this script work for mobile only. To apply something to mobiles, a parameter is generally used that checks the screen size and conditionally applies the script or not. In our case you should change the code to this:

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

I hope i fixed your problem 🙂