Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 604083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:00:00+00:00 2026-05-13T17:00:00+00:00

I have some jQuery going here: $(‘#ticker1’).hide(); $(‘#ticker2’).hide(); $(‘#ticker3’).hide(); $(#ticker).oneTime(2000,function(i) { /* Do the

  • 0

I have some jQuery going here:

$('#ticker1').hide();
$('#ticker2').hide();
$('#ticker3').hide();

$("#ticker").oneTime(2000,function(i) { /* Do the first pull out once */

    var randomNum = Math.floor(Math.random()*3); /* Pick random div to show */
    $('div#ticker div:eq(' + randomNum + ')').show();

    $("#ticker").animate({right: "0"}, {duration: 800 });

});

$("#ticker").oneTime(20000,function(i) { /* Do the first retract once */

    $("#ticker").animate({right: "-450"}, {duration: 800});

    $("#ticker").oneTime(1000,function(i) { 

        $('#ticker1').hide();

    });

});

$("#ticker").everyTime(21500,function(i) { /* Everytime timer gets to certain point */

    var randomNum = Math.floor(Math.random()*3);
    $('div#ticker div:eq(' + randomNum + ')').show();

    $("#ticker").animate({right: "0"}, {duration: 800}); /* Pull out right away */

    $("#ticker").oneTime(20000,function(i) { /* Retract once */

        $("#ticker").animate({right: "-450"}, {duration: 800});

    });

    $("#ticker").oneTime(21000,function(i) { /* Hide all divs once */

        $('#ticker1').hide();
        $('#ticker2').hide();
        $('#ticker3').hide();

    });

});

I am trying to get it to show a random div the first time it pulls out, which has been accomplished in the first part of the code. But after that right now I have it grabbing a random div (out of 3 divs) everytime after that too. I need to change this part of the code so it looks at the list of 3 divs and goes to the next one down every time.

So if the first time the div that pulled out was 2 then every time after that would go in this order: div 3, div 1, div 2, div 3, div 1 etc.

Here is a demo of what is going on right now: treethink.treethink.net/backup

Thanks,
Wade

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:00:00+00:00Added an answer on May 13, 2026 at 5:00 pm

    instead of generating a new random number every time, generate it first then increment it with a mod 3, that way you will get the next divs in order.

    for example, if your random number generated 2, the next one would be 3%3 = 0, then 1%3 = 1 then 2%3 = 2 and so on.

    var randomNum = Math.floor(Math.random()*3);
    
    $("#ticker").everyTime(21500,function(i) { /* Everytime timer gets to certain point */
    
    randomNum = (randomNum+1)%3;
    
    $('div#ticker div:eq(' + (randomNum) + ')').show();
    
    
    $("#ticker").animate({right: "0"}, {duration: 800}); /* Pull out right away */
    
    
    $("#ticker").oneTime(20000,function(i) { /* Retract once */
    
        $("#ticker").animate({right: "-450"}, {duration: 800});
    
    });
    
    $("#ticker").oneTime(21000,function(i) { /* Hide all divs once */
    
        $('#ticker1').hide();
        $('#ticker2').hide();
        $('#ticker3').hide();
    
    });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 296k
  • Answers 296k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you have Java 6 installed, checkout the Splash-Screen tutorial. May 13, 2026 at 7:12 pm
  • Editorial Team
    Editorial Team added an answer If you are trying to copy markup (the aspx, not… May 13, 2026 at 7:12 pm
  • Editorial Team
    Editorial Team added an answer From what I can see in the documentation, Spawning just… May 13, 2026 at 7:12 pm

Related Questions

Basically: I have this HTML: <div id=foo><img src=/foo/bar/{var}/foo alt={var}></div> When calling (using jQuery in
I am trying to put some jquery UI code into an existing asp.net app,
I'm working on a table where all rows have at least one class. Some
I have a Page which has a Control on it with 2 textboxes (username
I was actually not going to, and am afraid of asking such a silly

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.