1 回答

TA貢獻1828條經驗 獲得超13個贊
對于任何感興趣的人,我還沒有找到一種方法來在銷毀時保留原生點。但是我使用了一種解決方法,因此我創建了自己的自定義點并使用了它們。
我設置dots: false了輪播選項,然后將我自己的點列表綁定到像這樣的輪播事件
// This method listens to sliding and afterwards sets corresponding category to active
jQuery('.owl-carousel').on('translated.owl.carousel', function(event) {
$('.category-list li.active').removeClass('active');
//You have to set your li data attribute to the position it has in carousel
$('.category-list li[data-slide="'+ event.item.index +'"]').addClass("active");
});
//This method moves to corresponding slide upon clicking a category
$('.category-list').on('click', 'li', function(e) {
jQuery('.owl-carousel').trigger('to.owl.carousel', [$(this).index(), 250]);
});
添加回答
舉報