Wikiki / bulma-carousel

Display a carousel
MIT License
136 stars 99 forks source link

Bug: infinite slider doesn't show if contained slides is less than slidesToShow #89

Open chivent opened 5 years ago

chivent commented 5 years ago

For example if options are set to slidesToShow:3, infinite:true and there are only 2 slides in the carousel, the carousel will be shown as empty with a cloneNode error.

It might be due to the calculations for infinite slides, where calculated slideIndex goes into negatives once infiniteCount >= slider.state.length, and a cloneNode error occurs as this.slider.slides[-1] is undefined


// infinite.js: 16-19
for (var i = this.slider.state.length; i > this.slider.state.length - 1 - this._infiniteCount; i -= 1) {
    slideIndex = i - 1;
    frontClones.unshift(this._cloneSlide(this.slider.slides[slideIndex], slideIndex - this.slider.state.length));
}

however I might be wrong, would be cool if there was a fix!