1
這讓我想起了一個循環。所以我想只能滑動頁面上的下一個<table>
。現在我已經嘗試了所有的東西,但是它沒有工作,我沒有想法。切換下表中的內容
這裏是鏈接到代碼:
$(document).ready(function() {
$('.toggle-step').on('click', function() {
$(this).parent().next('table').slideToggle("fast");
$(this).find('span').slideToggle(0);
});
});
<div class="table-wrapper">
<ul class="nav nav-pills">
<li class="active">
<a class="toggle-step">Toggle Table <span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true" style="display: inline-block;"></span> <span class="glyphicon glyphicon-triangle-right" aria-hidden="true" style="display: none;"></span> </a>
</li>
</ul>
<table>
...
</table>
</div>
'.parent()'只上升在DOM – j08691
這引出了一個問題一個級別可能我已經做了.parent的next()。下一個()()? – zemaker
不,因爲.parent()讓你從錨點移動到列表項目 – j08691