猫头鹰轮播设置为当前幻灯片有效

时间:2018-10-19 08:30:11

标签: jquery owl-carousel owl-carousel-2

所以我有一些按钮,可用于导航到猫头鹰轮播的幻灯片。

我希望能够将活动类添加到与当前幻灯片相关的当前按钮。到目前为止,这是我尝试过的:

$('.btn-latest-navigate').each(function(){
        $(this).on('click', function(e){
            e.preventDefault();

            var navigation = $(this).data('navigate');
            var carouselFinder = $('.post-slider-rtl-latest');

            carouselFinder.trigger('to.owl.carousel', navigation);
            //console.log(navigation);
            carouselFinder.on('changed.owl.carousel',function(property){
                var current = property.item.index;

                if (navigation = current ){
                    console.log('1 is active');
                }
            });

            //console.log(navigation);
        });
    });

我不确定在当前幻灯片索引等于按钮数据导航时如何获取按钮以添加活动类别。

0 个答案:

没有答案