Search code examples
javascriptowl-carouselowl-carousel-2

OwlCarousel autoheight on data update


I have OwlCarousel, which has an autoheight parameter set to true. When I update the data inside the <div class = 'owl-item'> block, the height does not automatically change.\

I understand that this should not be, but, as an example, the block was empty, I added the data and it remained empty. Although, it's just a height of 1px.

Is it possible to change height on data inside changed?


Solution

  • Right after you've updated your <div class='owl-item'> you need to call the method to refresh your owl-carousel so it can update its height. Here an example.

    But basically you can call it this way:

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