M
M
Maxim Kononov2017-04-08 00:01:42
css
Maxim Kononov, 2017-04-08 00:01:42

How to make a spoiler closed by default?

How can I make this spoiler appear closed by default?

$(document).ready(function(){
     $('.spoiler_title').on('click', function(){
         $('.spoiler_toggle').slideToggle(100, function() {
             var visible = $(this).is(':visible');
             $('.spoiler_indicator').html(visible ? '↑' : '↓');
         });
         $(this).toggleClass('active');
          return false;
     });
});

<a href="" class="spoiler_title">....</a> 
    <div class="spoiler_toggle">
    <div class="spoiler_bg">...
    </div></div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-04-08
@slo_nik

Goodnight.
As an option Or in the css file the same

.spoiler_toggle{
 display:none;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question