JSFiddle - React, Tailwind, and code Playground
HTML
<div id="A"></div>
<div id="B"></div>
CSS
#A{
background-color: red;
}
#B{
background-color: blue;
}
#A,#B{
width: 100px;
height: 100px;
}
JavaScript
var animations = [];
animations.push($('#A').animate({
width: 200
}, 1000));
animations.push($('#B').animate({
height: 200
}, 1000));
$.when.apply($, animations).then(function() {
alert('a');
});