How to re-render a owl-carousel item?

前端 未结 7 1527
太阳男子
太阳男子 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:26

    Ran into the same issue with OP. I manage to get it to work by first removing the owl-loaded class. Then on render, trigger a refresh event after re-adding the class.

    // Remove the owl-loaded class after initialisation 
    $owl.owlCarousel().removeClass('owl-loaded');
    
    // Show the carousel and trigger refresh
    $owl.show(function() {
      $(this).addClass('owl-loaded').trigger('refresh.owl.carousel');
    })
    

提交回复
热议问题