Owlcarousel2: owl carousel 2 not work with loop and 1 items

Created on 31 Aug 2015  路  8Comments  路  Source: OwlCarousel2/OwlCarousel2

Problem:
when I have one content (dynamic content using PHP) loop:true and items:1 not work and I see blank But if I add two content Owl worked true!!

problem : http://jsfiddle.net/Sambora/93cpX/144/

Worked: http://jsfiddle.net/Sambora/93cpX/145/

approved for development bug help wanted

Most helpful comment

As a fast workaround check the amount of images before initialising the slider.

    var slider= $('.owl-carousel');
    var amountHeaderImages = slider.find('img').length;

    slider.owlCarousel({
        items: 1,
        loop: (amountHeaderImages > 1) // if only 1 item no loop
    });

All 8 comments

Decrised the min items to 2 (actual dimension of 1 item loop carousel) when loop to generate clones from 4.

As a fast workaround check the amount of images before initialising the slider.

    var slider= $('.owl-carousel');
    var amountHeaderImages = slider.find('img').length;

    slider.owlCarousel({
        items: 1,
        loop: (amountHeaderImages > 1) // if only 1 item no loop
    });

@davidspiess This workaround unfortunately doesn't work if you use the responsive
item count option.

This issue appears to be fixed in 2.0.0-beta.3 release. Fiddle of the broken example with owlcarosel swapped out here: http://jsfiddle.net/qb0qm5sa/1/

It's still not fixed.

Fixed!!!!!!

check if more than one image is present or not. If yes then initialize owl carousel. otherwise not.

This should already be fixed.

Still have the same problem on ngx-owl-carousel-2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hopea114y picture hopea114y  路  3Comments

Laraveldeep picture Laraveldeep  路  3Comments

siwel picture siwel  路  3Comments

unite4 picture unite4  路  4Comments

edelworksgithub picture edelworksgithub  路  4Comments