From 5359ffb5cc0b5dd4216a26543b8d57236827af69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 2 Mar 2011 07:37:27 -0500 Subject: [PATCH] Widget: Initialize implemenetation for _show() and _hide() to support animations across plugins. --- ui/jquery.ui.widget.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 10a25b61193..3f62cde3398 100644 --- a/ui/jquery.ui.widget.js +++ b/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 );