-
-
Notifications
You must be signed in to change notification settings - Fork 440
Description
Checks
- Not a duplicate.
- 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
v4.1.4
Description
I have multiple, working slides on a page.
What I'm trying to achieve is allowing slides to loop and autoplay when there are enough slides to do so.
According to the docs, something like this should probably work, as I'm able to control other options based on isOveflow
:
slides.on('overflow', function(isOverflow) {
slides.go(0);
slides.options = {
clones: isOverflow ? undefined : 0,
autoplay: true,
}
});
The clones
option is working as expected, and if I put another option in there like gap
and amend it based on isOverFlow
then it works fine, even with a single value, proving that the function is working as expected.
I don't know why autoplay isn't controllable in here, as it seems I'm needing to enable it in the main options list, which means that when there are not enough slides to fill the track, it still autoplays, even though the clones are not present.
Other relevant options:
type: 'loop',
gap: '1.5rem',
pagination: false,
autoWidth: true,
arrows: false,
interval: 4000,
speed: 4000,
perMove: 1,
easing: 'linear',
Reproduction Link
No response
Steps to Reproduce
- Create carousel with enough slides to overflow, then another that does not
- Implement the on overflow function and try to control autoplay only when overflow is true
Expected Behaviour
Slides should only autoplay when there are enough to overflow. Currently it does not seem like we can trigger autoplay based on overflow.