head over to https://www.npmjs.com/
- npm install detectAnimationEnd --save
- import it: import detectAnimationEnd from 'detectAnimationEnd'; (you might use require).
Get a reference to your element, and then add an eventListener on it. How you do that is up to you, but here is an example.
const eventEnd = detectAnimationEnd();
document.querySelector(YOURSELECTOR).addEventListener(eventEnd.animation, () => {
callback(); // whatever your callbabck is.
})
Note: the 'effectEvent.animation' above is for 'animation'. For 'transition', it would be 'effectEvent.transition'