Skip to content

Commit

Permalink
Effects: Jump to final state and execute callbacks when $.fx.off is s…
Browse files Browse the repository at this point in the history
…et to true. Fixes #6131 - Dialog breaks when $.fx.off. Partial fix for #5512 - jQuery.fx.off and effect on jQuery UI Effects.
  • Loading branch information
scottgonzalez committed Oct 4, 2010
1 parent c3145b6 commit 3b38025
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions ui/jquery.effects.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,29 @@ function standardSpeed( speed ) {
$.fn.extend({
effect: function(effect, options, speed, callback) {
var args = _normalizeArguments.apply(this, arguments),
// TODO: make effects takes actual parameters instead of a hash
// TODO: make effects take actual parameters instead of a hash
args2 = {
options: args[1],
duration: args[2],
callback: args[3]
},
mode = args2.options.mode,
effectMethod = $.effects[effect];

return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;
if ( $.fx.off || !effectMethod ) {
// delegate to the original method (e.g., .show()) if possible
if ( mode ) {
return this[ mode ]( args2.duration, args2.callback );
} else {
return this.each(function() {
if ( args2.callback ) {
args2.callback.call( this );
}
});
}
}

return effectMethod.call(this, args2);
},

_show: $.fn.show,
Expand Down

0 comments on commit 3b38025

Please sign in to comment.