【jQuery】 展開收合功能
/
0 Comments
jQuery 程式碼:
$('.header').click(function () {
$(this).toggleClass('expand').nextUntil('tr.header').slideToggle(500);
});
HTML 部分:
<div class="container">
<div class="header"><span>Expand</span>
</div>
<div class="content">
<ul>
<li>This is just some random content1.</li>
<li>This is just some random content2.</li>
<li>This is just some random content.</li>
<li>This is just some random content.</li>
</ul>
</div>
</div>
實際 Demo :
http://jsfiddle.net/eK8X5/10885/
$('.header').click(function () {
$(this).toggleClass('expand').nextUntil('tr.header').slideToggle(500);
});
HTML 部分:
<div class="container">
<div class="header"><span>Expand</span>
</div>
<div class="content">
<ul>
<li>This is just some random content1.</li>
<li>This is just some random content2.</li>
<li>This is just some random content.</li>
<li>This is just some random content.</li>
</ul>
</div>
</div>
實際 Demo :
http://jsfiddle.net/eK8X5/10885/