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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:15:00+00:00 2026-06-04T13:15:00+00:00

I have a JS routine (triggered by the user) that can take some time

  • 0

I have a JS routine (triggered by the user) that can take some time to complete. While the routine is running, I want to show a progress overlay on screen. Here’s the code that calls the routine (this is called in response to a click event):

function handleClick() {
    $('div#progressOverlay').removeClass('hidden');
    myBigRoutine();
    ...
    $('div#progressOverlay').addClass('hidden');
}

The class toggle triggers a change in opacity and visibility (animated with a transition).

The class changes themselves are working fine; the first is executed before the slow routine and the second is executed after everything else.

The issue is that the visual appearance of #progressOverlay doesn’t change until after myBigRoutine() finishes.
The result is that the progress overlay flashes on screen for a split second and then is immediately hidden again (all with no animation)

Is there a way to force the visual update/repaint to occur before (or, even better, in parallel with) the big JavaScript routine?

  • 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-04T13:15:01+00:00Added an answer on June 4, 2026 at 1:15 pm

    You can bind an event to animation finish. So, when animation finishes, only then your code will execute,

    function handleClick() {
        $('div#progressOverlay').removeClass('hidden');
    
    }
    
    $("div#progressOverlay").bind("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd", function(){
        myBigRoutine();
        ...
        $('div#progressOverlay').addClass('hidden');
    });
    

    I hope, this is what you need 🙂

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

Sidebar

Related Questions

I have a routine that examines thousands of records looking for discrepancies. This can
I have a routine that dynamically changes a select list's selected option when the
I have a series of systems on a LAN running a synchronized display routine.
In linux, why can't we have a mutex inside an isr() routine for protecting
I have the variant of the following codes, triggered by a user input. NSLog(@WHY
I have a routine that takes a list of strings as a parameter, but
I have a routine that needs to be supplied with normalized strings. However, the
I have this routine which is called onmouseover of a certain element. I want
I have this routine that calculates the seconds-to-date for a struct tm . On
I have a routine that updates information on a web page. The page is

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.