I am using Flexslider - http://www.woothemes.com/flexslider/ and I have a slider setup with 37 slides in it (yes I know this is ridiculous). I need a way where when the page loads, it randomly picks a slide between slide 1 and slide 37, and then it continues on squentially from there.
For example:
The page loads and it randomly picks slide # 17. The next slide to appear after slide 17 should be 18, then 19, then 20 and so on.
The next time the page loads it randomly picks another slide. Say this time it loads 29. The next slide should be 30, then 31, then 32, etc...
I have the logic figured out so far that I know I need a way to first have Flexslider count the number of slides in the current slider. Then I need to take that number and pick a random number between 1 and X # of slides in the slider.
I found some code on the Flexslider site:
start: function(slider) {
$('.total-slides').text(slider.count);
},
Which I understands gives you the number of slides, but from here I'm not sure what to do to get a random number to pass to the
startAt: 0,
option.
Here is my current flexslider jquery
jQuery( document ).ready( function( $ ) {
$('.flexslider').flexslider({
animation: "slide",
useCSS: false,
controlNav: false,
slideshow: false,
start: function(slider) {
$('.total-slides').text(slider.count); // This gets the number of slides in the slider
},
startAt: 0, //This should be a random number
});
});