J'écris un script en utilisant un framework d'animation JQuery. Dans ce scénario, j'ai besoin d'une séquence d'animations différentes. Quand une nouvelle animation commence, j'ai besoin de changer l'image d'arrière-plan de la page.Pré-chargement du diaporama d'images asynchrones JQuery
Le cadre d'animation (il est appelé JSTween) fournit les callbacks suivants:
onStart: function() {},
onStop: function() {}
Je suis à la recherche d'une mise en œuvre JQuery pour le pseudo-code suivant:
onStart: function() {
load new background;
}
onStop: function() {
// This animation has ended, about four seconds have passed
on new background loaded: {
// Change background
}
// Start new animation async
}
J'ai cherché $.when
et des outils similaires, mais je ne peux pas comprendre comment les utiliser correctement.