diff options
author | jzaefferer <joern.zaefferer@gmail.com> | 2011-04-21 14:30:42 +0200 |
---|---|---|
committer | jzaefferer <joern.zaefferer@gmail.com> | 2011-04-21 14:30:42 +0200 |
commit | 3bb9ab262670328de9eb9a97892e9cf85c55c7d9 (patch) | |
tree | cf4101b64c30d93af925d652e13efdda02c029d1 | |
parent | 3950a0515d58a8af2840f419bcd5cb8fd28b4de2 (diff) | |
download | jquery-ui-3bb9ab262670328de9eb9a97892e9cf85c55c7d9.tar.gz jquery-ui-3bb9ab262670328de9eb9a97892e9cf85c55c7d9.zip |
Tooltip: Add support for delaying showing/hiding. Still need to figure
out how to combine that with non-animated show/hide.
-rw-r--r-- | demos/tooltip/custom-animation.html | 6 | ||||
-rw-r--r-- | ui/jquery.ui.tooltip.js | 4 | ||||
-rw-r--r-- | ui/jquery.ui.widget.js | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/demos/tooltip/custom-animation.html b/demos/tooltip/custom-animation.html index d32bba0d2..d0689a0eb 100644 --- a/demos/tooltip/custom-animation.html +++ b/demos/tooltip/custom-animation.html @@ -13,10 +13,12 @@ $(function() { $(".demo").tooltip({ show: { - effect: "slideDown" + effect: "slideDown", + delay: 250 }, hide: { - effect: "slideUp" + effect: "slideUp", + delay: 500 } }); }); diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index c481f6264..bbf58c2a1 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -90,7 +90,7 @@ $.widget("ui.tooltip", { of: target }, this.options.position ) ).hide(); - + tooltip.stop( true ); this._show( tooltip, this.options.show ); this._trigger( "open", event ); @@ -111,7 +111,7 @@ $.widget("ui.tooltip", { var tooltip = this._find( target ); target.removeAttr( "aria-describedby" ); - tooltip.stop(); + tooltip.stop( true ); this._hide( tooltip, this.options.hide, function() { $( this ).remove(); }); diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 9593c1eaf..9634eaa1f 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -359,7 +359,9 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { var hasOptions = !$.isEmptyObject( options ), effectName = options.effect || defaultEffect; options.complete = callback; - + if (options.delay) { + element.delay( options.delay ); + } if ( hasOptions && $.effects && $.effects[ effectName ] ) { element[ method ]( options ); } else if ( element[ effectName ] ) { |