owl carousel 2 not work with loop and 1 items (Bug Fixed Now)

后端 未结 4 1032
清歌不尽
清歌不尽 2021-02-15 19:19

I work with owl carousel 2 for carousel content.

JS:

$(\'#owl-demo\').owlCarousel({
    loop: true,
    margin: 10,
    nav: true,
    items: 1,
});
         


        
4条回答
  •  不思量自难忘°
    2021-02-15 20:00

    I used this method to solve the problem and I think it's pretty easy.

    var options={
        margin: 10,
        nav: true,
        items: 1
        };
       if($('#owl-demo .owl-item').length>1){
           options.loop=true;
       }
       $('#owl-demo').owlCarousel(options);
    

提交回复
热议问题