diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-10-04 14:52:06 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-10-04 14:52:06 -0400 |
commit | 3b38025cedca458c100176c273c8d3956a7a5459 (patch) | |
tree | aa321af6eae799f03485351689681a54666b7e08 /ui/jquery.effects.core.js | |
parent | c3145b691b0d028f94fc43c035047d532de94112 (diff) | |
download | jquery-ui-3b38025cedca458c100176c273c8d3956a7a5459.tar.gz jquery-ui-3b38025cedca458c100176c273c8d3956a7a5459.zip |
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.
Diffstat (limited to 'ui/jquery.effects.core.js')
-rw-r--r-- | ui/jquery.effects.core.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index a835a062f..d052b3f86 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -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, |