Bootstrap Tab 手动切换

Bootstrap Tab 示例代码

<div class="tabs-container">
	<ul class="nav nav-tabs">
		<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">TB1</a></li>
		<li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">TB2</a></li>
		<li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">TB3</a></li>
	</ul>
	<div class="tab-content">
		<!--TB1-->
		<div id="tab-1" class="tab-pane active">
			<div class="panel-body">
				<div class="example">
					TB1
				</div>
			</div>
		</div>
		<!--TB2-->
		<div id="tab-2" class="tab-pane">
			<div class="panel-body">
				TB2
			</div>
		</div>

		<!--TB3-->
		<div id="tab-3" class="tab-pane">
			<div class="panel-body">
				TB3
			</div>
		</div>
	</div>
</div>

Bootstrap Tab 手动切换代码


切换到tab-2
 
$('.nav-tabs a[href="#tab-2"]').tab('show');


 

评论区域