Hi,
I am using 2.0.0-beta.2.4.
When loop:true and there is only one item it fails with uncaught TypeError
Uncaught TypeError: Cannot read property 'clone' of undefined
Upon inspecting the elements, Owl is trying to add 2 more items with cloned class
I have followed the issue reported before
http://stackoverflow.com/questions/32311300/owl-carousel-2-not-work-with-loop-and-1-items-bug-fixed-now
https://github.com/OwlCarousel2/OwlCarousel2/pull/1028
However its not reflected on the version I have downloaded.
This hack works
owl.carousel.js
line 289
changing from
delta = this.settings.loop ? clones.length - Math.max(this.settings.items * 2, 4) : 0
to
delta = this.settings.loop ? clones.length - Math.max(this.settings.items * 2, 2) : 0
However single item is rolling over like crazy.
Instead it would be desirable to set loop:false when only one item is present.
Thanks!
I generally use:
loop: $(this).find('.owl-carousel .item').size() > 1 ? true:false,
as a temp fix on each carousel.
@vorbe which can be simplified down to just:
loop: $(this).find('.owl-carousel .item').size() > 1
(Sorry about the canned reply.)
You have not added a link to a working live example.
Please add a link to a page where I can verify this error. You can use a service like jsfiddle, plnkr, jsbin or codepen.
And make sure you're using the latest Owl Version! I will close this issue for now, once you provided a working example you can reopen it.
Most helpful comment
I generally use:
loop: $(this).find('.owl-carousel .item').size() > 1 ? true:false,as a temp fix on each carousel.