Callback is raised before objects are shown with fadeIn() and jQuery.fx.off = true
|Reported by:||Owned by:||timmywil|
With animations disabled, $('#object').fadeIn(500, callback) calls the user sent callback function before actually showing the object in the DOM.
Example: See jsFiddle at http://jsfiddle.net/kf4vu/22/
With animations enabled, the callback is raised correctly (ex: same code but with animations on , http://jsfiddle.net/yhECL/).
Furthermore, the callback works as expected using .show, ( $('#obj').show(callback) ) with animations either on or off, so this seems to be strictly a fadeIn/fadeOut/similar animations issue.
This causes many issues, especially when trying to .focus() an input field; if the callback is called before the parent element is shown, it doesn't focus (ex: http://jsfiddle.net/bDgav/1/), and jQuery docs even say that IE will throw an error (calling .focus() on hidden element).
This is only an issue with animations off ( jQuery.fx.off = false ), and works as expected with animations on.
Change History (12)
comment:2 Changed 6 years ago by
|Component:||unfiled → effects|
|Priority:||undecided → high|
|Status:||new → open|