Carousel does not work properly if there is only 1 item
If a carousel only has one item and the controls are displayed, they still trigger a next or previous slide. The next or previous carousel item, however, does not exist so a really small blank item is displayed.
Admittedly, this issue can be handled by not showing the controls if there is only one item. This gets a bit tricky if the items are generated dynamically or if they change after the carousel has been created.
Suggestion: The carousel controls should do nothing if there is no next or previous item or it should go to the same page. The first option is preferable.
Hey, you shouldn't initialize the carousel if there is only 1 element. Bit I had the same problem, so thi is how i solved this
$('.carousel').each(function() {
if($(this).find('.carousel-inner .item').length > 1){
$(this).carousel({interval: 10000})
.hover( function () {$(this).carousel('pause')},
function () {$(this).carousel('cycle')});
}
else{
$(this).find('.carousel-control').hide();
}
});
-- close
The Carousel should natively handle this without the need for manual workarounds.
fixed in 2.0.1-wip