Fix for #1214, #1216, #1234 (problem with animations). In a nutshell, the callback needs to occur even if the animation does not run.

This commit is contained in:
John Resig 2007-06-21 02:38:16 +00:00
parent 6f510757ab
commit 5e6c14993a

View File

@ -307,16 +307,15 @@ jQuery.fn.extend({
*/ */
animate: function( prop, speed, easing, callback ) { animate: function( prop, speed, easing, callback ) {
return this.queue(function(){ return this.queue(function(){
var hidden = jQuery(this).is(":hidden"); var hidden = jQuery(this).is(":hidden"),
opt = jQuery.speed(speed, easing, callback),
self = this;
for ( var p in prop ) for ( var p in prop )
if ( prop[p] == "hide" && hidden || if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
prop[p] == "show" && !hidden ) return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
return;
this.curAnim = jQuery.extend({}, prop); this.curAnim = jQuery.extend({}, prop);
var opt = jQuery.speed(speed, easing, callback);
var self = this;
jQuery.each( prop, function(name, val){ jQuery.each( prop, function(name, val){
var e = new jQuery.fx( self, opt, name ); var e = new jQuery.fx( self, opt, name );