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

后端 未结 4 2056
执念已碎
执念已碎 2021-02-15 19:40

I work with owl carousel 2 for carousel content.

JS:

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


        
4条回答
  •  -上瘾入骨i
    2021-02-15 19:53

    I hope the below method will solve your problem.
    You dont need to edit the owl carousel js. The same method can be applied to Bx Slider also.

    $('.owl-demo').owlCarousel({
        margin: 0,
        responsiveClass: true,
        smartSpeed: 500,
        dots: ($(".owl-carousel .item").length > 1) ? true: false,
        loop:($(".owl-carousel .item").length > 1) ? true: false,
        responsive: {
            0: {
                items: 1,
            },
            500: {
                items: 1,
            },
            768: {
                items: 1,
            }
        } 
    })
    

提交回复
热议问题