Ticket #7934 (closed enhancement: fixed)
$.fn.animate to implement deferreds
| Reported by: | danheberden | Owned by: | danheberden |
|---|---|---|---|
| Priority: | high | Milestone: | 1.6 |
| Component: | effects | Version: | git |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Spoke with gnarf about this, our idea is to have the lastPromise available on the collection for animate, so:
$elements.animate( properties ).promise().then(
function() {
/* gets called when ALL animations are complete */
});
In this case, using with $.when would probably be the most advised route:
$.when( $elements.animate( properties ) ).then( fn );
The benefit would not only be for that particular animation set, but building a collection of them as well and being able to .then( fn ) once they are all done.
Change History
comment:3 Changed 2 years ago by danheberden
- Owner set to danheberden
- Status changed from new to assigned
comment:5 Changed 2 years ago by danheberden
Since Addy was asking about it, I made a better "what the hell do I mean" fiddle:
http://jsfiddle.net/danheberden/4upzp/
Of course, this only uses the newer method signature but hopefully illustrates the point.
comment:6 Changed 2 years ago by danheberden
And a bit more real world example: http://bit.ly/eW36V7
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

There may be other .fn's that could provide a promise as well like .load()