Answer the question
In order to leave comments, you need to log in
How to animate a child class of the same type of blocks?
Good afternoon, there are three blocks of the same type:
<div class="question_block">
<div class="question_block__question">
</div>
<div class="question_block__answer">
</div>
</div>
// тут я присваиваю нажатому блоку класс active
$('.question_block').click(function(q) {
q.preventDefault();
$(this).toggleClass('active');
});
// здесь и начинается...
$('.question_block').click(function(q) {// при нажатии на активный блок...
if($('.question_block__answer').is(':hidden')){//...проверяется скрыт ли блок ответа...
$('.question_block__answer').fadeIn(600);}//...если да - всплываем его...
else{$('.question_block__answer').fadeOut(600);}//если нет - гасим
});
Answer the question
In order to leave comments, you need to log in
$('.question_block').click(function(q) {
var $answer = $(this).parent().find('.question_block__answer');
if($answer.is(':hidden')){
.....
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question