I try to loop through all my cards and if the health of one of the cards is below 0 then I want to add a hide effect with a transition to that card. The Problem is that When there are several cards under 0 health (the last character in their innerHTML is the card's health), the hide-effect for one card cancels out the others. The effect only happens for one card. This is the code I run after all cards are fetched:
function destroydead(){
$('.card').each(function(i){
if ($(this).is(':empty')){
}else{
var stats = $(this).find(".attdef").html();
if(parseInt(stats.slice(-1)) <= 0){
$(this).hide(1000);
}
}
});
}