lukaszflorczak / vue-agile

🎠 A carousel component for Vue.js
https://lukaszflorczak.github.io/vue-agile/
MIT License
1.49k stars 167 forks source link

Empty slides when slidesToShow > 1 #168

Open gbrocha opened 4 years ago

gbrocha commented 4 years ago

Describe the bug I was using the carousel with slidesToShow = 7 to show 7 slides per page. When configuring slidesToScroll = 7 to pass 7 slides for navigation, it seems to me that Agile considered it as if there were 7 pages, but there were only 3 in fact (21 slides in total / 7). All of the following slides were empty spaces.

Code

`<Agile :initialSlide="todayIndexInWeeks" class="calendar__week--carousel" :dots="false" :slidesToShow="7" :slidesToScroll="7" :infinite="false"

{{ day.format('ddd') }}

`

To Reproduce

simply use slidesToScroll > 1

Expected behavior

what would be expected would be the behavior of passing the slides 7 in 7 without empty slides left.

Screenshots

The correct behavior seen in that SS: screenshot

And what happens when the 21 slides run out and empty slides start to appear: screenshot

Environment:

tomphilpotts commented 4 years ago

I have the same issue with slidesToScroll, lots of empty space even though with infinite: true

Saggitarie commented 2 years ago

Is this solved?

Maizerer commented 2 years ago

i have the same issue using Nuxt with :options="{ slidesToShow: 4, dots: false, navButtons: false, swipeDistance: 15, infinite: false, }" after scrolling through all the slides, then there are 3 empty slides

geoffyuen commented 2 years ago

I also have the same issue. It would be great if viewing the last slide it would align to the right side of the container -- especially if slidesToShow is fractional (eg. slidesToShow: 2.25)

harimchung commented 1 year ago

is it solved? I have just same problem

gTerrusa commented 1 year ago

I just had this issue. I was able to get around it by creating a new component, extending VueAgile, and overriding the 'canGoToNext' computed property. (Just changing the - 1 at the end of it to be - this.settings.slidesToShow) .... for those having issues with fractional slidesToShow, I think that having it be Math.floor(this.settings.slidesToShow) would work also, but this is untested.

components/ExtendedAgile.vue

<script>
import { VueAgile } from 'vue-agile'

export default {
  name: 'ExtendedAgile',

  extends: VueAgile,

  computed: {
    canGoToNext () {
      return (this.settings.infinite || this.currentSlide < this.countSlides - this.settings.slidesToShow)
    }
  }
}
</script>