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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:46:34+00:00 2026-05-29T07:46:34+00:00

css .item { display: none; } html <div> <div class=item>machin</div> <div class=item>chose</div> <div class=item>chouette</div>

  • 0

css

.item {
  display: none;
}

html

<div>
  <div class="item">machin</div>
  <div class="item">chose</div>
  <div class="item">chouette</div>
  <div class="item">prout</div>
</div>

I’m using jQuery and I’d like to make each .item appearing after a random little timer like:

javascript

$('.item').each(function () {
  itm = $(this);
  setTimeout(function () {
    itm.fadeIn(1000);
  }, Math.floor(Math.random() * 1000));
})

Here itm will always contain the last item because the function is evaluated after all assignments.
I can’t use the 3rd parameter of setTimeout() because it will not work on IE.
It’s not advised to use setTimeout() with the eval method for security reasons.

So how can I access to my object through setTimeout() ?


Edit

I know that this question have already been posted.
But I though that it were slightly specific with the each() context.
Now someone have entirely changed the title of my question that was originally something like ‘setTimeout() – jQuery.each() this object parameter’

  • 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-29T07:46:36+00:00Added an answer on May 29, 2026 at 7:46 am

    Do not use setTimeout, use jQuery own tools.

    $('.item').each(function () {
       $(this).delay(Math.random() * 1000).fadeIn();
    })
    

    http://api.jquery.com/delay/

    Working example: http://jsfiddle.net/qENhd/

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

Sidebar

Related Questions

My html looks like this <input id=txt value=></input> <div class=link-item>jK</div> <div class=link-item>JFOO</div> my js
Here's HTML <div id=taxonomylist> <div class=item-list><ul><li class=first><a href=/?q=category/activity/energy class=views-processed>Energy</a></li> <li><a href=/?q=category/activity/energy/3-5 class=views-processed>3-5</a></li> <li><a href=/?q=category/activity/energy/6-8
I am using this jquery navigation: http://css-tricks.com/5582-jquery-magicline-navigation/ I would like to have the navigation
I have this code in jquery: $(.pun).hover(function() { $(.guns).show(0); }); My html <div class=pun>
Is there any way to set a CSS class on an input item in
I've got a css menu like this: <ul> <li><a>Item1</a></li> <li><a>Item Two</a></li> <li><a>Item C</a></li> <li><a>A
I want to have the same functionality of select in HTML but using div
I am trying to use jquery to add a class to my css menu
I have a menu item that which I've created using display:table-cell; to ensure that
Please see http://jsfiddle.net/mithun/nuF2Q/1/ I've the HTML structure <div id='slider'> <ul> <li> <a class='pride' href=i1.html>

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.