クリックで開閉するスライドパネル

Ads

Result

jQuery

$(document).ready(function(){
    //クリックイベント
    $('.head').click(function(){
        //class="row"をスライドで表示/非表示する
        $(this).next('.row').stop(true, true).slideToggle();
    });
});

html

<div class="head">Panel 1 </div>
<div class="row">
    <div>Panel 1 sample</div>
    <div>Panel 1 sample</div>
    <div>Panel 1 sample</div>
</div>

<div class="head"> Panel 2</div>
<div class="row">
    <div>Panel 2 sample</div>
    <div>Panel 2 sample</div>
    <div>Panel 2 sample</div>
</div>
 
<div class="head"> Panel 3</div>
<div class="row">
    <div>Panel 3 sample</div>
    <div>Panel 3 sample</div>
    <div>Panel 3 sample</div>
</div>
タイトルとURLをコピーしました