Skip to content

Commit 3b38025

Browse files
committed
Effects: Jump to final state and execute callbacks when $.fx.off is set to true. Fixes #6131 - Dialog breaks when $.fx.off. Partial fix for #5512 - jQuery.fx.off and effect on jQuery UI Effects.
1 parent c3145b6 commit 3b38025

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

ui/jquery.effects.core.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,29 @@ function standardSpeed( speed ) {
456456
$.fn.extend({
457457
effect: function(effect, options, speed, callback) {
458458
var args = _normalizeArguments.apply(this, arguments),
459-
// TODO: make effects takes actual parameters instead of a hash
459+
// TODO: make effects take actual parameters instead of a hash
460460
args2 = {
461461
options: args[1],
462462
duration: args[2],
463463
callback: args[3]
464464
},
465+
mode = args2.options.mode,
465466
effectMethod = $.effects[effect];
466467

467-
return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;
468+
if ( $.fx.off || !effectMethod ) {
469+
// delegate to the original method (e.g., .show()) if possible
470+
if ( mode ) {
471+
return this[ mode ]( args2.duration, args2.callback );
472+
} else {
473+
return this.each(function() {
474+
if ( args2.callback ) {
475+
args2.callback.call( this );
476+
}
477+
});
478+
}
479+
}
480+
481+
return effectMethod.call(this, args2);
468482
},
469483

470484
_show: $.fn.show,

0 commit comments

Comments
 (0)