Deferred obj

by Alexander Pankov

HTML

<div id="d1">1</div>
<div id="d2">2</div>
<span></span>

CSS

#d1 {
    width:100px;
    height:100px;
    background:red;
}
#d2 {
    width:100px;
    height:100px;
    background:green
}

JavaScript

var a1 = $.Deferred(),
    a2 = $.Deferred();

$('#d1').slideUp(2000, a1.resolve);
$('#d2').fadeOut(4000, a2.resolve);

$.when(a1, a2).done(function () {
    $("span").text('SHIET!!! All animation is complited');
});