HTML:
<li class="page_item ">
<a href="javascript:">A</a>
<ul class="children">
<li class="page_item"><a href="">1</a></li>
<li class="page_item"><a href="">2</a></li>
</ul>
</li>
<li class="page_item ">
<a href="">B</a>
<ul class="children">
<li class="page_item"><a href="">1</a></li>
<li class="page_item"><a href="">2</a></li>
<li class="page_item"><a href="">3</a></li>
<li class="page_item"><a href="">4</a></li>
</ul>
</li>
<li class="page_item ">
<a href="">C</a>
<ul class="children">
<li class="page_item"><a href="">1</a></li>
<li class="page_item"><a href="">2</a></li>
<li class="page_item"><a href="">3</a></li>
<li class="page_item"><a href="">4</a></li>
</ul>
</li>
JS:
$('.page_item').click(function() {
var that = this;
$('.page_item').each(function() {
if (that == this) return true; //continue
$('.children:not(:hidden)', this).slideToggle();
});
$('ul.children', this).slideToggle();
});
オンラインデモ: http://jsfiddle.net/kHLuR/1/
li
最初のセクションをデフォルトで開くにはどうすればよいですか?