-1

I have 5 possible images for the header of my WP home page.

But I display only one image. I use revolution Slider to display it (nice text effects ...).

I would like to display randomly one of theses 5 images. Is that possible ?

I can't find, either on Revolution Slider website, either on any forum how to display one single random image with Revolution Slider. I only found a script to randomize the order of multiple slides.

Thanx for your help. M

Marc
  • 55
  • 6

1 Answers1

0

I found a solution, it works with Revolution Slider 6.

I wrote that in the custom JS editor associated with Slider Revolution :

const totalSlides = jQuery('rs-slide').size();
const randomIndex = Math.floor(Math.random() * totalSlides);
for (let i = 0 ; i < totalSlides ; i++) {
    if (i !== randomIndex) {
      revapi1.revremoveslide(i);
    }
}
Marc
  • 55
  • 6