I know there're a lot of subject like this, but I didn't find an correct answer.
When the document is loaded, I would like all my blocks closed (slideUp).
When the user click on a block, the text slide down siblings others open blocks (so it closed others blocks if opened).
I have this, but it's working with only two blocks :
<div class="col-xs-12 wrap-blocks-concours">
<div class="col-xs-12 blocks-concours">
<div class="col-xs-8">
<img src="#" alt="Nicolas et Mathieu">
</div>
<div class="bandeau-nom-concours">
<h3 class="uppercase">Nicolas et Mathieu</h3>
</div>
<div class="col-xs-4 text-block selected">
<h5 class="uppercase">Content</h5>
</div>
</div>
<div class="col-xs-12 text-slide">
<h3>Content</h3>
</div>
</div>
And my Jquery :
(function($) {
$(document).ready(function() {
$('.blocks-concours').click(function() {
var currentContent = $(this).siblings('.text-slide');
$('.text-slide').not(currentContent).slideUp();
currentContent.slideToggle().sibling($('.text-slide'));
});
});
})(jQuery);
Moreover, I have a display: none
on my text-slide
So how could I do this the more simply as possible ?