I'm developing a carousel using keen-slide, but I had problems finding a function to change more than one slide at a time.
Using a for to repeatedly call the .next() function, in my case it didn't work, my solution was to set a time for it to call.
Sorry for the English, I'm learning and I still use translate a little.
I'll leave my code with the example timer, if you have other solutions feel free to share
I'm developing a carousel using keen-slide, but I had problems finding a function to change more than one slide at a time. Using a for to repeatedly call the .next() function, in my case it didn't work, my solution was to set a time for it to call. Sorry for the English, I'm learning and I still use translate a little. I'll leave my code with the example timer, if you have other solutions feel free to share
const slider = new KeenSlider('#keen-Slider', { loop: false, slides: { perView: 6, spacing: 65, }, breakpoints: { "(max-width: 1024px)": { loop: true, slides: { perView: 3, spacing: 10, }, }, }, }); document.querySelector('.prev').addEventListener('click', () => { slider.prev(); setTimeout(function() { slider.prev(); }, 300); setTimeout(function() { slider.prev(); }, 600); }); document.querySelector('.next').addEventListener('click', () => { slider.next(); setTimeout(function() { slider.next(); }, 300); setTimeout(function() { slider.next(); }, 600); });