私は、この画像に類似したドロップダウンエフェクトを作成しようとしています:GIFしかし、これまでのものはEXAMPLEです。複数のリンクを追加する方法を見つけられないようです。他のコンテンツ部門を追加しても表示されません。誰かが助けてくれることを願っています。おかげ折り畳み式容器/カラム。複数のリンクを追加する
HTML:
<div class="container">
<div class="header">Projects</div>
<div class="content" onclick="initContent('example')"><em>Example Project</em></div>
</div>
JSは:
$(".header").click(function() {
$header = $(this);
//getting the next element
$content = $(this).next();
//checking if its already visible
$content.slideToggle(500, function() {
//execute this after slideToggle is done
//change text of header based on visibility of content div
$header.text(function() {});
});
});
私がしようとするだろう何:
:
<div class="container">
<div class="header">Projects</div>
<div class="content" onclick="initContent('example')"><em>Example Project</em></div>
<div class="content" onclick="initContent('exampleNew')"><em>Example Project 2</em></div>
</div>
https://jsfiddle.net/sfcm95yz/6/自分のコードを自分の下に表示する –