BKWLD / vue-ssr-carousel

A performance focused Vue carousel designed for SSR/SSG environments.
https://vue-ssr-carousel.netlify.app
MIT License
132 stars 16 forks source link

Issue with disabling behavior when a peek and loop are specified #95

Closed fgrasu closed 1 year ago

fgrasu commented 1 year ago

Hi there. I noticed that setting slidesPerPage in responsive a value that is equal or higher than the carousel length, while the loop is true, will break the carousel. In this case, I think slidesPerPage value should at least default to the carousel length value - 1. What do you guys think?

This is how is displayed: image

weotch commented 1 year ago

I can't reproduce this issue. In this CodeSandbox link I've changed the first demo on that page to loop and I have more slidesPerPage than the actual number of slides.

image

The slides are rendering as expected for me.

Regarding

I think slidesPerPage value should at least default to the carousel length value - 1

In this case, I think you'd maybe do something like:

<ssr-carousel :slides-per-page='Math.min(3, slides.length - 1) />

Or something similar.

fgrasu commented 1 year ago

@weotch I played with the settings a little more. It seems like the peek prop is actually the issue when is set on default settings. See if you can reproduce it now. Not a big issue though, I can use your solution with Math.min, thanks. image

weotch commented 1 year ago

Oh yeah, I see what you mean

image

I'm going to keep this open to fix