Skip to content

Commit

Permalink
Widget: Initialize implemenetation for _show() and _hide() to support…
Browse files Browse the repository at this point in the history
… animations across plugins.
  • Loading branch information
scottgonzalez committed Mar 2, 2011
1 parent 31a181a commit 5359ffb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ui/jquery.ui.widget.js
Expand Up @@ -336,4 +336,24 @@ $.Widget.prototype = {
}
};

$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
options = options || {};
var hasOptions = !$.isEmptyObject( options ),
effectName = options.effect || defaultEffect;
options.complete = callback;

if ( hasOptions && $.effects && $.effects[ effectName ] ) {
element[ method ]( options );
} else if ( hasOptions && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
} else {
element[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
}
}
};
});

})( jQuery );

0 comments on commit 5359ffb

Please sign in to comment.