I'm trying to dynamically add items to an Owl carousel. Here is how I'm doing it:
HTML
<div id="avatar-carousel" class="owl-carousel lesson-carousel">
<div class="item item-logo">
<div class="product-item">
<div class="carousel-thumb" style="height: 77px!important;width: 70px;" >
<img src="http://placehold.it/140x100" alt="">
</div>
</div>
</div>
<!-- Start Item -->
</div>
<button id="click">
click
</button>
JS
$("#avatar-carousel").owlCarousel({
items: 5
});
$("#click").click(function(){
$('#avatar-carousel').trigger('add.owl.carousel', ['<div class="item"><p>' + 'hh' + '</p></div>'])
.trigger('refresh.owl.carousel');
});
Nothing happens with this code. I can't see the error. Here is the fiddle: JSFiddle.
EDIT:
Seems like the code is correct, as it's working in the fiddle. I forgot to mention that the carousel works just fine, it is loaded correctly in the beginning. The issue is when trying to add items. Nothing happens, no errors but items are not added.