Categories
JavaScript Answers

How to check whether a CSS3 transition of an element has started or end with JavaScript?

Spread the love

Sometimes, we want to check whether a CSS3 transition of an element has started or end with JavaScript.

In this article, we’ll look at how to check whether a CSS3 transition of an element has started or end with JavaScript.

How to check whether a CSS3 transition of an element has started or end with JavaScript?

To check whether a CSS3 transition of an element has started or end with JavaScript, we listen to the transitionend event.

For instance, we write

element.addEventListener("transitionend", callback, false);

to listen to the transitionend event emitted by element with addEventListener

callback is called when the transition is finished.

Conclusion

To check whether a CSS3 transition of an element has started or end with JavaScript, we listen to the transitionend event.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *