Bug Tracker

Opened 10 years ago

Closed 10 years ago

#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:
Blocked by: Blocking:

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 (1)

comment:1 Changed 10 years ago by dmethvin

Resolution: worksforme
Status: newclosed

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.

Note: See TracTickets for help on using tickets.