Refreshing Owl Carousel 2

2019-04-07 12:08发布

I have 3 divs that activate slide toggle when I click on them. And inside every div there is owl carousel slider.

If I trigger one div the slider shows, but when I click other div slider doesn't show unless I resize the window.

How can I trigger refresh on slide toggle for the slider in every div?

I tried with this on slide toggle but it doesn't work:

$('.owl-slider').trigger('refresh.owl.carousel');

1条回答
孤傲高冷的网名
2楼-- · 2019-04-07 12:43

You trigger with a class. You can try with a variable:

var $owl = $('.owl-carousel').owlCarousel({
    items: 1,
    loop:true
});

$owl.trigger('refresh.owl.carousel');
查看更多
登录 后发表回答