ganlanyuan / tiny-slider

Vanilla javascript slider for all purposes.
MIT License
5.24k stars 787 forks source link

Empty slides if loop is true and there is an equal or fewer number of items than the "items" setting. #529

Open ChatonMeow opened 4 years ago

ChatonMeow commented 4 years ago

Check the link below for a very barebones example.

Let's say I have a looping slider, which is supposed to always show 3 items, and slide only by 1.

If I have 4+ items, it works fine. When I'm at the last slide, the first slide gets "added" at the end and it appears as just one infinite loop.

However, if I only have like 3 items, the slides don't seem to loop. I get at the last slide (slide 3), and after that it's all blank. I can keep clicking "next", but it just scrolls empty slides.

Demo link/slider setting: https://codepen.io/Chaton/pen/MWYLgZe

Tiny-slider version: 2.9.2 Browser name && version: Chrome 79.0 OS name && version: Mac Catalina 10.15.2

fpmk commented 4 years ago

same problem, any fix or workaround for this?

ok, if I add "autoWidth: true" it's seems ok, but when I scroll to the last item, the next one doesn't immediately appear.

dimian90 commented 2 years ago

Unfortunately, this problem still exists, even when we run autoplay: true, the slider disappears after while

mohamadali13 commented 1 month ago

did u solve it ? i have the same problem

dimian90 commented 1 month ago

did u solve it ? i have the same problem

no, i migrated to swiperjs

mohamadali13 commented 1 month ago

ok thank u for ur replay