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 3940730
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:27:17+00:00 2026-05-20T00:27:17+00:00

Total Novice here. I have some list items. I need to add a class

  • 0

Total Novice here. I have some list items. I need to add a class of ‘.go’ to each list item, one at a time, spaced out by pre-determined blocks of time. (each block of time will be different durations).

For instance:

  1. the script adds a ‘.go’ class to the first (li)
  2. the ‘.go’ class holds on that (li) for exactly 4.5 seconds.
  3. once the 4.5 seconds are up, the script removes the ‘.go’ class from the current list item
  4. the script moves to the next (li) and adds a ‘.go’ class
  5. the ‘.go’ class holds on this (li) for 1.5 seconds.
  6. once the 1.5 seconds are up, the script removes the ‘.go’ class from the current list item
  7. And then the cycle repeats, until it has cycled through all the list items

The script I have been working on does not function. It adds all the classes to the (li)’s instantly. And then they fadeout at different intervals. Rather I need the classes to BE ADDED at different intervals. Here’s an example: http://jsfiddle.net/bM6uY/8/

                         <ul>
                            <li>hello</li>
                            <li>World!</li>
                            <li>Foo</li>
                            <li>Bar</li>
                         </ul>

         $(function() {
           $('ul li:nth-child(1)').addClass("go")
                   .delay(4500)
                   .queue(function() {
                       $(this).removeClass("go");
                       $(this).dequeue();
                   });


            $('ul li:nth-child(2)').addClass("go")
                   .delay(1500)
                   .queue(function() {
                       $(this).removeClass("go");
                       $(this).dequeue();
                   });    


             $('ul li:nth-child(3)').addClass("go")
                   .delay(500)
                   .queue(function() {
                       $(this).removeClass("go");
                       $(this).dequeue();
                   });      


             $('ul li:nth-child(4)').addClass("go")
                   .delay(5000)
                   .queue(function() {
                       $(this).removeClass("go");
                       $(this).dequeue();
                   });                              
            });
  • 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-20T00:27:18+00:00Added an answer on May 20, 2026 at 12:27 am

    How about something like this:

    $(function() {
        var index = 0;
        var length = $("ul").children().length;
        var delays = [
                500,
                1500,
                500,
                5000
        ];
    
        function delayNext()
        {
            setTimeout(function() {
                $("ul li:eq(" + index + ")").addClass("go").siblings().removeClass("go");
                index++;
    
                if (index == length)
                    index = 0;
    
                delayNext();
            }, delays[index]);
        }
    
        delayNext();
    });
    

    http://jsfiddle.net/rfvgyhn/9VL4r/2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload
Total noobie question here. I'm just learning Java, and studying passing arguments to functions.
Total noob question, but here. CSS .product__specfield_8_arrow { /*background-image:url(../../upload/orng_bg_arrow.png); background-repeat:no-repeat;*/ background-color:#fc0; width:50px !important; height:33px
Total n00b to C# and events although I have been programming for a while.
total nubi here and i'm trying to writ an application that trackes how far
I am a total Groovy newbie. I saw the following code here . def
Am fairly new to using MySQL and a total novice at Perl but am
I have worked out how to fade an element in: Click here to view
I'm fairly new to Linux (Ubuntu 10.04) and a total novice to assembler. I
So I have this array list that is populated using a csv file. Once

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.