_
_
_ _2012-10-25 21:41:05
css
_ _, 2012-10-25 21:41:05

CSS transitions and JavaScript

Good afternoon.
Suppose that there is a task to animate an object on the page, and then perform some action.

In the past, when JS was used to animate elements, you could use jQuery's action queue like $('#foo').slideUp().fadeIn();

What to do now that we have CSS transitions and want to use them?
For example, I add a class that collapses an element vertically and after that I would remove it from the DOM. The only thing that comes to my mind is to make setTimeout for a time, a little more than in transition. But if I suddenly want the animation to be slower, I will have to edit the JS too.

Are there any options to more elegantly perform this kind of manipulation?

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MT, 2012-10-25
@AMar4enko

Try using the event transitionend.

_
_ _, 2012-10-25
@AMar4enko

I also found JQuery Transit - it allows you to animate through transitions, make queues, from a simple fallback to a regular JS animation.
ricostacruz.com/jquery.transit/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question