1

I would like to have jquery execute certain statements only AFTER it has completed applying my css change. However, despite trying to search for the answer... I have been unable to so far. Any pointers, would be appreciated.

$('#elements').css( 'visibility', 'hidden'); 
$('#another_element').slideDown(); // should only be executed after the above is completely done
10
  • It would be happened like that.. Commented Jan 20, 2015 at 8:43
  • That's what I expected. However, both statements appear to begin executing at the same time. I would like to ensure that the second statement does not execute at all, until the first is completed... even if it takes some time. Commented Jan 20, 2015 at 8:45
  • $('#elements').css( 'visibility', 'hidden'); would be instant un-less you have some css transition/animation Commented Jan 20, 2015 at 8:46
  • 1
    @Grateful Other solution is to add a timer which checks for the css and then execute the subsequent command. Here is the answer stackoverflow.com/a/24484924/2000051 Commented Jan 20, 2015 at 8:53
  • 1
    Can you add the code to a fiddle? jquery's .css has no call back and should be doing what you want. Commented Jan 20, 2015 at 8:57

1 Answer 1

0

Okay. So the answer is that since there is no callback for the css function, it's not possible.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.