Forums

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

Home Forums JavaScript Anything Slider: Delayed Start of a Slider

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #34373
    bananablues
    Participant

    Hi,
    There are two autoplaying (Anything) slideshows on one page. How can i start one of them later, so they can alternately change the content.
    Thanks for your help!

    #87353
    Mottie
    Member

    You should be able to simply use a time out delay. Try something like this:

    $(window).load(function(){
    setTimeout(function(){
    $('#slider').data('AnythingSlider').startStop(true);
    }, 2000); // 2 second delay (1000 milliseconds = 1 second)
    });
    #87365
    bananablues
    Participant

    Thanks Mottie, it works!
    The scenario right now: first slideshow: delay: 10000, second slideshow: delay 10000 AND a setTimeout of 5000. That means, after 10 seconds slider1 is movin’, after 5 seconds slider2 is movin’, after 5 seconds slider1 is moivn’ and so on. Now i have to find a way how the first slider starts the FIRST sliding with a delay of 5 seconds instead of 10000 seconds. My first thought was a setTimeout with a negative value (-5000) ;), so the slideshows will moving every 5 seconds. Any ideas how to reach this properly?

    #87389
    Mottie
    Member

    Hehe you can’t set a negative time… unless you have a time machine in your pocket or something :P

    You should be able to just set the slide show time to 10 seconds on both sliders, then just start the second one after 5 seconds. Something like this:

    $(window).load(function(){
    // Start first slider
    $('#slider1').data('AnythingSlider').startStop(true);

    // Start second slider after a 5 second delay
    setTimeout(function(){
    $('#slider2').data('AnythingSlider').startStop(true);
    }, 5000); // 5 second delay (1000 milliseconds = 1 second)
    });
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.