Initial render is not centered when set to loop with a gap
Checks
- [X] Not a duplicate.
- [X] Not a question, feature request, or anything other than a bug report directly related to Splide. Use Discussions for these topics: https://github.com/Splidejs/splide/discussions
Version
4.1.3
Description
When I have a gap set on a carousel set to loop, I noticed that the initial render of carousel was not centered. It centers itself once I switch slides or initiate any sort of re-calculation.
From what I can tell, the initial translation value set on ul.splide__list was not matching the value after returning to the same slide and the difference is the gap value set.
Reproduction Link
No response
Steps to Reproduce
Create a new looping Splide instance with a gap set to a fairly visible value.
Expected Behaviour
Initial render should be centered
That seems to be related with https://github.com/Splidejs/splide/issues/712.
For me having a gap set was necessary to cause the issue
Then, it's working properly: https://codesandbox.io/s/982-xsxrq8?file=/index.html
Feel free to fork the sandbox and reproduce your issue so that I can debug it.
I've spent a good hour trying to get it to break on there but even with the exact settings and using Alpinejs, I've been unsuccessful.
Because the offset was always identical to the gap, I figured it was an issue with the package but I guess I have something funky going on on my end. I've been able to come up with a different solution for now so feel free to close this as it seems to be working as intended.