var sba_dfd = $.Deferred();
/*and so on*/
$("#sbas").click(function(){
$(this).css('background-color','#ed1c24');
sba_dfd.resolve();
}); /*and on*/
$(".x").click(function(){
var promise = $.when(sba_dfd.promise()/*and on*/);
if(promise.state("resolved")){
promise.then(function(){
$("#true").get(0).play();
$("#thumb").css({'background-color' : 'rgba(237,28,36,.4)'});
$("#div,#wrapper_overlay").hide();
});
} else {
$("#false").get(0).play();
}
});
I've got a bunch of deferreds
, that resolve on clicks
.
The resolution of deferreds
should be triggered after the click on .x
, but they trigger automatically. What have I missed here?