我需要ul.list-group-sub
應該一眼看不到任何東西,當我點擊「Click」(.dd
)時,只有一個「list-group-sub」應顯示來自當前li
的塊,而「list-group-子」應顯示從其他li
反之亦然沒有,只有一個是一個‘清單基團的子’一次打開向下滑動每個列表
小提琴演示: https://fiddle.jshell.net/alpeshlahad/zv3vpzew/3/
$(".list-group-item .dd").click(function() {
$("ul.list-group-sub").slideToggle();
});
ul.list-group-sub {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul class="list-group member-list trainers-data ot-box">
<li class="list-group-item">
List 1
<span class="label">
<a href="javascript:;" class="dd">Click</a>
</span>
<ul class="list-group-sub">
<li class="list-group-item checked">Sublist 1</li>
<li class="list-group-item checked">Sublist 2</li>
<li class="list-group-item checked">Sublist 3</li>
</ul>
</li>
<li class="list-group-item">
List 2
<span class="label">
<a href="javascript:;" class="dd">Click</a>
</span>
<ul class="list-group-sub">
<li class="list-group-item checked">Sublist 1</li>
<li class="list-group-item checked">Sublist 2</li>
<li class="list-group-item checked">Sublist 3</li>
</ul>
</li>
</ul>