jQuery: metodi per concatenare le animazioni
In jQuery esistono vari metodi per concatenare le animazioni.
In jQuery esistono vari metodi per concatenare le animazioni.
Il primo fa uso della funzione di callback dei metodi di animazione:
$( "#test" ).animate({
width: 200
}, function() {
$( this ).hide();
});
Il secondo fa uso del metodo .queue():
$( "#test" ).animate({
width: 200
}).queue(function() {
$( this ).hide();
});
Per il secondo metodo ricordatevi di ripristinare la coda delle animazioni se questa prosegue:
$( "#test" ).animate({
width: 200
}).queue(function() {
$( this ).hide().dequeue();
}).animate({
width: 100
});
Commenti