Skip to main content

Bug Tracker

Side navigation

#8551 closed bug (invalid)

Opened March 17, 2011 12:11PM UTC

Closed March 17, 2011 06:53PM UTC

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

Attachments (0)
Change History (1)

Changed March 17, 2011 06:53PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

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.