1 回答
![?](http://img1.sycdn.imooc.com/545847aa0001063202200220-100-100.jpg)
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]);
});
添加回答
举报