The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Anything Slider Start Panel Random

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #31233

    Hi there,

    I love Chris’s Anything Slider, it is awesome. One question though:

    Is there a way to set the starting panel to a random value. I notice there is a startpanel parameter than can be set to an integer, but can I make it choose a random value instead?

    Thanks, and happy coding!


    var randomSlide = Math.floor(Math.random()*7);

    startPanel: randomSlide;

    Where 7 is the amount of slides you have + 1.

    random() generates a random number between 0 and 1. floor() rounds off to the lowest whole number.

    We could round off to the highest whole number and not have to add 1 to the total slides, but it doesn’t seem to be as random – For some reason.



    I have a similar question if it’s not too late? Is there anyway to get the initial start panel to be just 1, instead of sliding from 3 to 1? Even if the startPanel is set to 1; it will still initially slide from 3 to 1 (on a page open or refresh). I hope this makes sense to someone who might know a way around as I’m totally out of ideas after houuurrrs!

    I’m referring to anythingSlider Demo#2 btw. Also, I’ve adjusted (slowed down) the animationTime to suit.. so this unwanted startPanel slide is more apparent than perhaps the demo page. Any help or tips much appreciated!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.