mui 選項卡切換(div模式)滑動切換時tab顏色不改變問題
tab標題是動態載入的:
<div id="slider" class="mui-slider mui-fullscreen">
<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
<div id="allTitle" class="mui-scroll">
</div>
</div>
<div id="allTopic" class="mui-slider-group">
<div id="item1" class="mui-slider-item mui-control-content mui-active ">
<div class="mui-scroll-wrapper">
<div class="mui-scroll">
<ul id="ul1" class="mui-table-view">
</ul>
</div>
</div>
</div>
</div>
</div>
點選tab切換沒問題,但是滑動時,tab顏色不發生變化。
實現滑動時tab隨滑動頁改變顏色:
document.querySelector('.mui-slider').addEventListener('slide', function(event) {
//alert("滑動監聽=="+event.detail.slideNumber);
$("#allTitle").find("a").attr("class","mui-control-item");
$("#allTitle").find("a").eq(event.detail.slideNumber).attr("class","mui-control-item mui-active");
});