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

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>

Warning: include(/home/youhei0828/kachibito.net/public_html/wp-content/themes/cocoon-master/my-php/jquery-other-snippets.php): Failed to open stream: No such file or directory in /home/youhei0828/kachibito.net/public_html/wp-content/themes/kachibito7_with_cocoon_child/functions-module/shortcode/add-post-myphp.php on line 7

Warning: include(): Failed opening '/home/youhei0828/kachibito.net/public_html/wp-content/themes/cocoon-master/my-php/jquery-other-snippets.php' for inclusion (include_path='.:/opt/php-8.1.29/data/pear') in /home/youhei0828/kachibito.net/public_html/wp-content/themes/kachibito7_with_cocoon_child/functions-module/shortcode/add-post-myphp.php on line 7