KevinBatdorf / liquidslider

A Responsive jQuery Content Slider
161 stars 62 forks source link

Random? #141

Closed frogpublications closed 9 years ago

frogpublications commented 10 years ago

Not an issue, just wondering if there is a way to make the first panel to load "random", and if so, how?

KevinBatdorf commented 10 years ago

Well, I guess if you know how many panels you have, you could just use a random number function and set it to the firstPanelToLoad setting:

firstPanelToLoad: Math.floor(Math.random()*(max-min+1)+min)

Let me know how it works out.

frogpublications commented 10 years ago

Thanks Kevin!

Since I'm a hack, can you walk me through it. Let's say I have 25 panels. Where would that information go in the code you provided above?

KevinBatdorf commented 10 years ago

Hey, you know where you put the settings in place?

$('.main-slider').liquidSlider({
     firstPanelToLoad: Math.floor(Math.random()*(25-1+1)+1)
});

I'm guessing something like that might work.