I am using a random function to randomly slide between 4 swiper sliders, here is my code :
var swipers = [swiper1, swiper2, swiper3, swiper4];
setInterval(function(){
var rand = Math.floor(Math.random() * 4);
swipers[rand].slideNext();
}, 3000);
}
How should i proceed if i wanted to randomize between slideNext() and slidePrev() ? I tried many things like this :
var direction = ['slideNext()', 'slidePrev()'];
var swipers = [swiper1, swiper2, swiper3, swiper4];
setInterval(function(){
var randx = Math.floor(Math.random() * 4);
var randy = Math.floor(Math.random() * 2);
swipers[randx].direction[randy];
}, 3000);
But it's not working, probably for obvious reasons, but please help me understand why it's not working. And how i could possibly achieve that?