CSS-Tricks / AnythingSlider

A jQuery Slider plugin for anything.
http://css-tricks.github.io/AnythingSlider/
GNU Lesser General Public License v3.0
1.15k stars 380 forks source link

Random start slide #589

Closed lorig closed 9 years ago

lorig commented 11 years ago

Think it would be possible to add an option for the slideshow begin at a random slide? For example, if my client has a slideshow of their sponsors, would it always have to start on the same one?

Mottie commented 11 years ago

Hi @lorig!

Try something like this (demo):

var $slider = $('#slider'),
    slides = $slider.children().length;

$('#slider').anythingSlider({
    startPanel: Math.floor(Math.random() * slides) + 1
});
lorig commented 11 years ago

Fantastic! Thank you so much!