Bug Tracker

Modify

Ticket #5572 (closed bug: worksforme)

Opened 3 years ago

Last modified 3 years ago

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

comment:1 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.