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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:55:46+00:00 2026-05-15T19:55:46+00:00

I have a jQuery script that fades in and fades out between containers inside

  • 0

I have a jQuery script that fades in and fades out between containers inside their parent container. Depending on the button (design, web) clicked, it determines which container (#design, #web) fades out and which one fades in in its place.

Now, the crux is here, both these containers (#design,#web) differ in height, so when I fade out and fade in between these containers, the page jumps up to a specific position directly after the fadeIn() function call finishes. That position (x,y) is exactly the same as the position the page would have been at if no containers (#design,#web) were visible inside the parent container (i.e. an empty container) and the page was scrolled all the way to the bottom.

Has anyone else encountered this before? Any advice is greatly appreciated, as this issue is bugging me endlessly.

PS. I have tested this in Firefox and Safari and both show the same issue.

// edit 1:
Here is a URL which you can check out: http://toolboxstudio.co.za/version3/?page=packages

If you want to see how the container would look empty: http://toolboxstudio.co.za/version3/?page=packages#empty, you can then click on a button (Design or Web) just below the banner. It will fade in the correct content, and toggle between the two. Make certain your page fits just the whole page with empty container in with no extra space beneath the footer. Then click on the buttons and scroll a small ways down, toggle between the two buttons. You’ll see what I mean about the page jumping.

Here’s the code:

$("div.design.button a").click(function () {
    $(this).parent("div").addClass("active");
    $("div.web.button").removeClass("active");

    if ($("div.web_content").is(":visible")) {
        $("div.web_content").fadeOut(function () {
            $("div.design_content").fadeIn();
        });
    } else {
        $("div.design_content").fadeIn();
    }
    window.location.hash = "#design";
    resizeWindow();

    e.returnValue = false;
    e.preventDefault();

    return false;

    alert("hello");     
});

$("div.web.button a").click(function () {
    $(this).parent("div").addClass("active");
    $("div.design.button").removeClass("active");

    if ($("div.design_content").is(":visible")) {
        $("div.design_content").fadeOut(function () {
            $("div.web_content").fadeIn();
            return false;
        });
    } else {
        $("div.web_content").fadeIn();
        return false;
    }
    window.location.hash = "#web";
    resizeWindow();

    e.returnValue = false;
    e.preventDefault();

    return false;

    alert("world");
});
  • 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-15T19:55:47+00:00Added an answer on May 15, 2026 at 7:55 pm

    I think I fixed it by changing the code to this:

    $("div.design.button a").click(function () {
        $(this).parent("div").addClass("active");
        $("div.web.button").removeClass("active");
    
        if ($("div.web_content").is(":visible")) {
            $("div.web_content").fadeOut();
            $("div.design_content").fadeIn();
                return false;
        } else {
            $("div.design_content").fadeIn();
        }
        window.location.hash = "#design";
        resizeWindow();
    
        e.returnValue = false;
        e.preventDefault();
    
        return false;
    
        alert("hello");     
    });
    
    $("div.web.button a").click(function () {
        $(this).parent("div").addClass("active");
        $("div.design.button").removeClass("active");
    
        if ($("div.design_content").is(":visible")) {
            $("div.design_content").fadeOut();
            $("div.web_content").fadeIn();
        } else {
            $("div.web_content").fadeIn();
        }
        window.location.hash = "#web";
        resizeWindow();
    
        e.returnValue = false;
        e.preventDefault();
    
        return false;
    
        alert("world");
    });
    

    @galambalazs:

    No, I don’t think that’s it, as I removed that first and nothing changed. I just didn’t suspect it would be the callback function error I made that would be the culprit.

    Sorry all, I really struggled for hours with this, StackOverflow is always my last resort. And then I just decided to try something and that did the trick.

    Sorry I can’t upload the code so you can see what I mean by “it works now”, SEACOM is down and we have limited resources available, our FTP port is blocked now.

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

Sidebar

Related Questions

I have a jQuery script that appends a row to a table. In short,
I have this small jquery script that does not work if I remove the
As per my previous question , I have a working animation which fades in
I've been trying to figure out how to work this jQuery Form plugin to
Hey guys, I have a bit of a weird problem. I have a jquery
OK rememebr how I wanted an IMAGE to go in and out according to
I am working on a php form with some jquery, especially for the error
I designed a simple site with some css and jquery. All the css is
I am using jQuery to build an array of images from a php array.
Not sure the best way to phrase the question, but suppose you are using

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.