Modify ↓
Ticket #5572 (closed bug: worksforme)
Animate Callback triggering twice
| Reported by: | thinkclay | Owned by: | |
|---|---|---|---|
| Priority: | trivial | Milestone: | 1.4 |
| Component: | core | Version: | 1.3.2 |
| Keywords: | animation, callback | Cc: | |
| Blocking: | Blocked by: |
Description
$("html, body").animate({scrollLeft:$(id).offset().left}, 3000, "swing", function(){ alert("animation finished"); });
When scrolling a page horizontally, both html and body have to be targeted to support all browsers. However, this also causes the animation callback twice. Not sure what the best approach is but felt that this should possibly be analyzed and fixed.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Since you've selected two elements in the animation, it makes total sense for the callback to fire twice. If you want the callback code to only run once just look at this.nodeName and only run it for either html or body.