Answer the question
In order to leave comments, you need to log in
How to show/hide elements in accordion headers?
Good afternoon. I've been trying to find an answer on the Internet for three days, but without success. There is something like this layout, which should work like an accordion:
<ul>
<li class="accordion-item">
<div class="header">
<h3>Accordion header</h3>
<span class="show">Минимальная цена</span>
<span class="hidden">Какая-то информация о продавце</span>
</div>
<div class="content">
Цена 1
Цена 2
Цена 3
</div>
</li>
<li class="accordion-item">
<div class="header">
<h3>Accordion header</h3>
<span class="show">Минимальная цена</span>
<span class="hidden">Какая-то информация о продавце</span>
</div>
<div class="content">
Цена 1
Цена 2
Цена 3
</div>
</li>
<li class="accordion-item">
<div class="header">
<h3>Accordion header</h3>
<span class="show">Минимальная цена</span>
<span class="hidden">Какая-то информация о продавце</span>
</div>
<div class="content">
Цена 1
Цена 2
Цена 3
</div>
</li>
</ul>
$("li.accordion-item").click(function() {
$(this).find(".content").slideToggle("fast");
$(".content").not($(this).children()).slideUp('fast');
});
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