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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:57:53+00:00 2026-05-28T14:57:53+00:00

This is my code: function transition(index){ $(#right-panel).find(img).each(function(){ if ($(this).index() === index){ setTimeout(function(){ $(this).fadeIn(750); },

  • 0

This is my code:

function transition(index){
    $("#right-panel").find("img").each(function(){
        if ($(this).index() === index){
            setTimeout(function(){
                $(this).fadeIn(750);
            }, 100000000);
        }else{
            $(this).fadeOut(750);
        }
    });
}

For some reason, the setTimeout in the function is not causing a delay for the fadeIn. What am I doing wrong?

  • 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-28T14:57:53+00:00Added an answer on May 28, 2026 at 2:57 pm

    this in the setTimeout callback isn’t the same as outside it.

    var self = this;
    setTimeout(function(){
        $(self).fadeIn(750);
    }, 100000000);
    

    Although you could just use .delay().

    $(this).delay(100000000).fadeIn(750)
    

    Overall a better approach would seem to be to use .eq() to grab the one you want to .fadeIn(), and .fadeOut() the rest.

    function transition(index){
        var images = $("#right-panel").find("img");// get all the images
        var fadein = images.eq(index)
                           .delay(100000000)
                           .fadeIn(750); // fadeIn the one at "index"
        images.not(fadein).fadeOut(750); // fadeOut all the others
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this setup, just to find the index() of an element, but it
I have a code like this <script type=text/javascript> function email(){ var myTextField = document.getElementById('email_hidden').value;
I have looked high and low and can't seem to find this anywhere. Does
So this code looks fine, I can't seem to see where the error is
I have this code below. It works fine in safari however in IE the
this is the first page : index.html <!DOCTYPE html> <html> <head> <link rel=stylesheet href=../test/style.css>
* *Updated code as of 3-28 Index.php <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
I'm following this example in: http://bxslider.com/examples/perform-action-transition-callback But with this example I can get the
I have this AS3 slideshow code, that loads an XML with a list of
I have this php code: <?php if(!file_exists('counter.txt')){ file_put_contents('counter.txt', '0'); } if($_GET['click'] == 'yes'){ file_put_contents('counter.txt',

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.