A common question from clients is whether or not they can start the opening slide on their website randomly.  Well, if you’re using Slider Revolution 5 then it’s possible!

There are two methods which allow you to do this, the first is to just select a slide at random or start with a random first slide.  If you take the latter option, it will follow the cycle set up in Slider Revolution.

Both of these require JavaScript which you can enter in the WordPress plugin.  Just select the Custom JavaScript window within the plugin settings page.


Slider Revolution: Custom CSS and JavaScript entry boxes
Slider Revolution: Custom CSS and JavaScript entry boxes

Method one: Random slides

To configure completely random slides in any order, just insert the following code into the Custom JavaScript field;

var slides = jQuery('.rev_slider').find('li'),
totalSlides = slides.length - 1,
randomIndex = Math.round(Math.random() * totalSlides);


Method two: Random first slide

To enable a random first slide, that then proceed in the order they were originally configured, use this code;

var slider = jQuery('.rev_slider ul'),
slides = slider.find('li'),
totalSlides = slides.length,
randomIndex = Math.round(Math.random() * totalSlides - 1),
ar = [], i;
slides.each(function(i) {ar[i] = this});
for(i = randomIndex; i < totalSlides; i++) slider.append(ar[i]);
for(i = 0; i < randomIndex; i++) slider.append(ar[i]);


Need more help?

As always, if you need more help and assistance – please contact us for help!

Remember to always take a backup of your site before starting any code adjustments just in case it doesn’t work out.  This guide doesn’t mean it will work for all sites and versions of Slider Revolution, but it will work for the majority…