Bug Tracker

Modify

Ticket #8551 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

.animate() callback function executed immediately if the function has .apply()

Reported by: anonymous Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.1
Keywords: Cc:
Blocking: Blocked by:

Description

$('#id').animate(

{

'height':'toggle'

}, 5000, 'linear', function(){

console.log(1)

}.apply(this)

});

This function would console.log(1) when the animation starts instead of when it is complete. This is down to the .apply() as when it is removed the callback executes at the correct moment.

Change History

comment:1 Changed 2 years ago by dmethvin

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

I agree with your analysis, which is why this code is not related to any jQuery problem. It is explicitly running the function immediately rather than passing a function object to .animate() for later callback.

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.