Wie kann ich eine Funktion warten, bis eine animation abgeschlossen ist?

Habe ich verwendet JQuery für eine kleine animation arbeiten: eine Tabelle #photos enthält 9 Fotos, und ich möchte, um zu erhöhen die Breite und die Höhe mithilfe der animate Funktion bei mouseover. Aber während die animation läuft, wenn der Benutzer bewegt die Maus, um ein weiteres Foto-es löst automatisch die nächste animation, es ist also völlig verwirrt. Was soll ich tun? Mein code ist:

$(function(){
  $("#photos tr td img").mouseover(function(){
    $(this).animate({"width":"1000px","height":"512px"},2000)
  });
  $("#photos tr td img").mouseout(function(){
    $(this).animate({"width":"100px","height":"50px"},2000)
  });       
});
Schreibe einen Kommentar