I guess the answer depends on what you want to accomplish on the second garbage (while the first is still animating).
1) If you want nothing to happen, you can configure your first βfreezingβ status for the entire TR, possibly as follows:
$tr = $(this).closest("tr"); if ($tr.data("animating") != true) { $tr.data("animating",true); $(this) .stop(true,false) .animate({"width":"1000px","height":"512px"},2000, function(){ $tr.data("animating",false); }); }
2) If you want the original animation to end so that your new image can be animated, you need to use .stop (), the old one with the clearQueue and goToEnd parameters set to true. This ensures that additional events in the queue (from a whole group of hangs) will not continue for several minutes, and this will cause the animation to immediately go to its final state:
$(this).closest("tr").find("img:animated").stop(true,true); $(this).animate({"width":"1000px","height":"512px"},2000});
Doug avery
source share