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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:11:03+00:00 2026-06-09T08:11:03+00:00

This probably has been asked numerous times (I just couldn’t find it). I have

  • 0

This probably has been asked numerous times (I just couldn’t find it).

I have four links which all correspond to their own “div” with information in it. What I want to happen is (the first div is displayed by default), click on the second link and the first fades out and the second div fades in (at the same spot of the other). I got the fade in/out working (in a sense), but they all just stack up and do some weird movement. I would appreciate any help. I have placed a test file on jsfiddle. My jquery probably is a bit screwy as well.

http://jsfiddle.net/buScL/

  • 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-06-09T08:11:05+00:00Added an answer on June 9, 2026 at 8:11 am

    The problem is that your fading effects are all trying to happen at the same time. Using callbacks, you can control the order more strictly. See this JS Fiddle, or the identical code below. Why the ugliness when the fades happen at the same time? The blocks are naturally stacked according to the normal flow. When one is in the process of fading out, it still takes up space in the flow. It only releases that space at the very end of the fade, when display:none goes into effect. When the replacement box is fading it, it gets positioned below where it would normally belong until that final space release. That’s when it pops back up to the top in an ugly way. Check out jQuery’s documentation on fadeToggle and check out the callback section (fadeIn and fadeOut work the same way).

    <div id="hello"> hello world! </div>
    <div id="goodbye"> goodbye world! </div>
    

    Javascript:

     ​$("#hello").click(function(){
            $(this).fadeToggle("slow", function(){
               $("#goodbye").fadeToggle("slow"); //Here is a callback
            });           
        });
    
    
    $("#goodbye").click(function(){
        $(this).fadeToggle("slow", function(){
           $("#hello").fadeToggle("slow") //Here is a callback
        }) ;             
    });
        ​
    

    css:

    div{
        width:100px;
        height:100px;
    }
    
    #hello{
        background-color:red  ; 
    }
    
    #goodbye{
        background-color:blue;
        display:none;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize this question has probably been asked numerous times, but I have not
This has probably been asked already - if so sorry! I couldn't find it.
This probably has probably been asked before, but I couldn't find anything relevant. Would
This has probably been asked before but I can't find it anywhere. I have
This is probably a question that has been asked before, but I couldn't find
This has probably been asked before, but I couldn't find it. Is there a
This has probably been asked before but I couldn't find the answer to my
This has probably been asked a thousand times... But i'm sure i have all
This has probably been asked many times but here it goes : I have
I know this has been asked probably a thousand times, but I've been biting

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.