Opened 12 years ago
Closed 12 years ago
#8551 closed bug (invalid)
.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.
Note: See
TracTickets for help on using
tickets.
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.