我正在动态添加Owl旋转木马项目。它是以正常的方式添加的,但当我滚动到第二页查看添加的图像时,它一定会变小(大约30%的高度)。如果我调整浏览器的大小,它会变为正确的大小。
$(".all_diplomas").owlCarousel({
loop: true,
margin: 15,
responsive: {
1000: {
items: 4
},
1200: {
items: 2
}
},
});
$('input#generateInputsForDiplomas').on('click',function() {
var template = '<div class="item"> <div class="content_diplomas autoHeightClass"> <a data-fancybox="gallery" href="images/6.jpg"><i class="material-icons">search</i></a>' +
'<figure><img src="images/6.jpg" alt=""></figure> </div> </div>';
$('.all_diplomas').trigger('add.owl.carousel', [template]).trigger('resize.owl.carousel').trigger('refresh.owl.carousel');
});
我尝试在刷新carousel之前/之后使用resize方法,但它不起作用。有没有办法解决这个问题?谢谢