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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:15:20+00:00 2026-05-16T08:15:20+00:00

Each of the list items is hidden and each list can only be shown

  • 0

Each of the list items is “hidden” and each list can only be shown after the list item before it has been shown.

// HTML
<ul>
    <li id="list-1" class="list-item">
        <a href="#">List 1</a>
    </li>
    <li id="list-2" class="list-item">
        <a href="#">List 2</a>
    </li>
    <li id="list-3" class="list-item">
        <a href="#">List 3</a>
    </li>
</ul>



// CSS
ul li {
    overflow: hidden;
    position: relative;
}

ul li a {
    position: relative;
    top: -20px;
}


// jQuery
$('#list-1').animate({
    top: '0'
}, 500, function() {
    $('#list-2').animate({
        top: '0'
    }, 500, function() {
        $('#list-3').animate({
            top: '0'    
        }, 500)
    })  
})

The jQuery code above works if there is always going to be 3 list items, but how can that code be modified to accomodate any number of list items?

Thanks for any help!

  • 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-16T08:15:20+00:00Added an answer on May 16, 2026 at 8:15 am

    You could use the .list-item class for the selector, and inside an .each(), use .delay() to delay the animation by the index value of the current iteration multiplied by 500 milliseconds.

    Try it out: http://jsfiddle.net/EFGCM/

    $('ul > li.list-item').each(function( i ) {
        $('a',this).delay( i * 500 ).animate({ top: '0'}, 500);
    });
    
    • http://api.jquery.com/each/
    • http://api.jquery.com/delay/

    The .delay() requires jQuery 1.4 or later.


    EDIT: This would be a little more efficient.

    http://jsfiddle.net/EFGCM/3/

    $('ul > li.list-item > a').each(function(i) {
        $(this).delay(i * 500).animate({ top: '0'}, 500);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of items. When I create the list each item has
I have a list of items, where each item is a simple class containing
I have here a list of items in a table. Each item has a
I'm trying to use templates to get std:list of items, where each item has
I have a list with an arbitrary number of items. Each item has a
Basically i wanna show total list items for each list item that contains sub
I have several ReorderLists on a page. Each list has items added to it
My app shows a list of items, where each line is an item title
Say I have a list of items from a database. Next to each item
I'm trying to make a ListView with 2 items in each 1 list item

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.