当我在 owl carousel 中使用单个项目时,循环不会停止。我希望它停止一个项目,当我添加其他项目时它会开始工作。以下是我的代码:
$('.owl-carousel').owlCarousel({
loop:true,
margin:10,
nav:false,
dots:false,
responsive:{
320:{
stagePadding:11,
items:1
},
425:{
stagePadding:45,
items:1
},
768:{
items:2
},
1000:{
items:3
}
})
答案 0 :(得分:0)
如果没有看到您的其余代码就很难说 - 但是您可能应该以编程方式设置 loop
,例如:
const numChildren = $('#container .child').length; // just an example
const isLooping = numChildren > 1;
$('.owl-carousel').owlCarousel({
loop: isLooping,
...
});