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

The Archive Base Latest Questions

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

Am I able to, and if so how, delay the return of a Javascript

  • 0

Am I able to, and if so how, delay the return of a Javascript function?

For example, say I use JS to set the background of an element that employs CSS3’s transitions, and that transition takes 1 second, I’d like to return the function after the transition has finished (after 1 second).

Something like this (pseudo code):

function
    element.style = 'background: #aaa; transition: all 1s ease-in;' // this will take 1 second to transition, although the JS is executed immediately

    after 1 second // delay the return until the CSS3 transition completes.
        return element

I hope this all makes sense! Thank you in advance, your help is much appreciated!

It might be helpful for everyone to see the actual code too: http://jsfiddle.net/BtNSs/1/

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

    No, you’re not able to do this. In browsers, JavaScript and the UI share the same thread, so the animation will not begin until your JavaScript code finishes executing.

    If you want to do something after the animation completes, use the transitionend event.

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

Sidebar

Related Questions

How can I use jQuery to trigger a callback of a JavaScript function when
anyone able to tell me how often a materialized view is set to refresh
I want to be able to capture the exception that is thrown when a
I am not able to display the rectangles after a certain delay in code.
We are using ExtJS for a webapplication. In that application, we use the standard
I am in need to delay the execution of a line of code, say,
I would like to be able to delay the default action of an event
There is a JavaScript function, of which I have zero control of the code,
I am using a JavaScript script that tells me if specific image URLs are
Please consider the following class. I'm beginning to use JQuery. function AutoHide(elemControl, elemContent) {

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.