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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:30:11+00:00 2026-05-26T21:30:11+00:00

My undestanding is jQuery doesn’t move to the next function until the running one

  • 0

My undestanding is jQuery doesn’t move to the next function until the running one is complete. However it seems like this isn’t working for me. For example:

                    $("#bigmap").animate(
                    {
                    opacity: 0
                    }, 500).css("display", "none");     

I expect this would fade out #bigmap and then set its display to none. However, it seems to be set to none immediately.

I’m new to this so sure it’s something obvious.

  • 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-26T21:30:12+00:00Added an answer on May 26, 2026 at 9:30 pm

    Your best option here is actually this:

    $('#bigmap').fadeOut(500);
    

    This will fade it out and automatically hide it when done.

    To explain a bit why your original code didn’t work as you expected, you need to understand a bit about both jQuery animations and javascript.

    jQuery animations go into an animation queue and are executed over time (using timers). The call to .animate() just starts the animation and then that function returns, long before the animation is completed. The animation does not complete until some time later. Thus, the next chained method is executed as soon as the call to .animate() returns (right after the animation was started).

    The chained methods $(selector).aaa().bbbb().cccc() are executed synchronously by the javascript engine so jQuery doesn’t control their timing.

    Fortunately, as other answers have also told you, there is a completion function for the .animate() method so that you can execute some code when the animation completes and you can put your code to hide the object in there.

    $('#bigmap').animate({opacity:0}, 500, function() {
        $(this).hide();
    });
    

    Even better than this is to use the .fadeOut() method which will automatically hide the object when done and then you don’t even have to worry about this issue at all because the hiding is built into the jQuery .fadeOut() method:

    $('#bigmap').fadeOut(500);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im making a collision checking system with jQuery however it doesn't seem to work.
I understand that Javascript doesn't have multiple threads, but I'd like to know if
So I'm using this pretty standard jquery plugin pattern whereby you can grab an
Of course it's jQuery, and not my lack of understanding causing this issue, but
Been using Javascript libraries like Prototype and jQuery for development, for a while now.
Running my (rather complex) JavaScript/jQuery application in Google's Chrome browser, it would appear that
I am having some real difficulty attempting to solve a JQuery $.each() iteration This
I'm trying to understand this jquery code, I understand all of it: the modulo,
I'm getting started with JQuery and javascript in general and I'm running into an
I am extremely new to jQuery and AJAX, however after 7 hours of reading

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.