var num = $img.length; $imgs.load(function() { num--; if (num > 0) { return; } console.log('load compeleted'); }