Operlapping Nicescroll scrolbars in Bootstrap tabs
因为我的tab是指定id的
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="vtTab" role="tablist">
<li role="presentation" class="active"><a href="#aero" aria-controls="aero" role="tab" data-toggle="tab">Test1</a></li>
<li role="presentation"><a href="#musc" aria-controls="musc" role="tab" data-toggle="tab">Test2</a></li>
<li role="presentation"><a href="#daily" aria-controls="daily" role="tab" data-toggle="tab">Test3</a></li>
</ul> <!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="aero">
<div id="aero_content"></div>
</div>
<div role="tabpanel" class="tab-pane" id="musc">
<div id="musc_content"></div>
</div>
<div role="tabpanel" class="tab-pane" id="daily">
<div id="daily_content"></div>
</div>
</div>
JS:
//滚动条
$("#aero,#musc,#daily").niceScroll({
touchbehavior:false,
cursorwidth:6,
cursorborder:"0px",
cursorborderradius:"15px",
background:"rgba(255,255,255,0)",
autohidemode:"true"
}); // hw acceleration enabled when using wrapper
$('#vtTab a').click(function (e) {
e.preventDefault()
$(this).tab('show');
//切换滚动条
$("#aero,#musc,#daily").getNiceScroll().hide();
switch (index){
case 0:
$("#aero").getNiceScroll().show();
break;
case 1:
$("#musc").getNiceScroll().show();
break;
case 2:
$("#daily").getNiceScroll().show();
break;
} })