Browse files

Widget: Initialize implemenetation for _show() and _hide() to support…

… animations across plugins.
  • Loading branch information...
1 parent 31a181a commit 5359ffb5cc0b5dd4216a26543b8d57236827af69 @scottgonzalez scottgonzalez committed Mar 2, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 ui/jquery.ui.widget.js
View
20 ui/jquery.ui.widget.js
@@ -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.