How to re-render a owl-carousel item?

前端 未结 7 1501
太阳男子
太阳男子 2020-12-09 05:49

Well, I\'m using a owl-carousel-2 plugin now.

And I encounter the following problem:

The markup code:

7条回答
  •  旧巷少年郎
    2020-12-09 06:25

    This works for me:

    // get owl element
    var owl = $('.owl-carousel');
    
    // get owl instance from element
    var owlInstance = owl.data('owlCarousel');
    
    // if instance is existing
    if(owlInstance != null)
        owlInstance.reinit();
    

    More information: http://owlgraphic.com/owlcarousel/demos/manipulations.html

提交回复
热议问题