我正在尝试使用以下 jQuery 创建手风琴:
var allPanels = $('.accordion > div.showlist > p.showdetails').hide();
$('.accordion > div.showlist > strong').click(function() {
allPanels.slideUp();
$(this).parent().next().slideDown();
return false;
});
的HTML:
<div class="accordion">
<div class="showlist">
<div class="showdate">date</div>
<strong>The title</strong>
<p class="showdetails">There is more info in here about the show here.</p>
</div>
<div class="showlist">
<div class="showdate">date</div>
<strong>The title</strong>
<p class="showdetails">There is more info in here about the show here.</p>
</div>
<div class="showlist">
<div class="showdate">date</div>
<strong>The title</strong>
<p class="showdetails">There is more info in here about the show here.</p>
</div>
</div>
被p.showdetails
隐藏得很好,但是strong
单击时没有任何反应。知道我做错了什么吗?