Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question