From e609bebaae7f3f762dd61d92fb0529af9ef5f2d1 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Fri, 15 Apr 2011 16:49:29 +0200 Subject: Custom tooltip animations based on widget-animations branch. --- ui/jquery.ui.tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/jquery.ui.tooltip.js') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 534b3c947..bff17d7b5 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -91,7 +91,7 @@ $.widget("ui.tooltip", { }, this.options.position ) ).hide(); - tooltip.fadeIn(); + 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.fadeOut( function() { + this._hide( tooltip, this.options.hide, function() { $( this ).remove(); }); -- cgit v1.2.3 From 3950a0515d58a8af2840f419bcd5cb8fd28b4de2 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Fri, 15 Apr 2011 16:53:05 +0200 Subject: Stop show animation on hide. Now that we don't reuse the tooltip element, we can safely do that. --- ui/jquery.ui.tooltip.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ui/jquery.ui.tooltip.js') diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index bff17d7b5..c481f6264 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -111,6 +111,7 @@ $.widget("ui.tooltip", { var tooltip = this._find( target ); target.removeAttr( "aria-describedby" ); + tooltip.stop(); this._hide( tooltip, this.options.hide, function() { $( this ).remove(); }); -- cgit v1.2.3 From 3bb9ab262670328de9eb9a97892e9cf85c55c7d9 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Thu, 21 Apr 2011 14:30:42 +0200 Subject: Tooltip: Add support for delaying showing/hiding. Still need to figure out how to combine that with non-animated show/hide. --- demos/tooltip/custom-animation.html | 6 ++++-- ui/jquery.ui.tooltip.js | 4 ++-- ui/jquery.ui.widget.js | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'ui/jquery.ui.tooltip.js') 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 ] ) { -- cgit v1.2.3 From 0496a50238a47463c171219b6370173874193130 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Mon, 2 May 2011 18:21:04 +0200 Subject: Tooltip: Replace offset property with inline my+offset to make it easier to override the offset. Fixes the odd offset in the video player demo. Also doesn't need units. --- demos/tooltip/video-player.html | 2 +- ui/jquery.ui.tooltip.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'ui/jquery.ui.tooltip.js') diff --git a/demos/tooltip/video-player.html b/demos/tooltip/video-player.html index 73310e349..c890c76b4 100644 --- a/demos/tooltip/video-player.html +++ b/demos/tooltip/video-player.html @@ -32,7 +32,7 @@ $(".demo").tooltip({ position: { my: "center top", - at: "center bottom+5px" + at: "center bottom+5", }, show: { duration: "fast" diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index bbf58c2a1..20638cba5 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -24,9 +24,8 @@ $.widget("ui.tooltip", { return $( this ).attr( "title" ); }, position: { - my: "left center", - at: "right center", - offset: "15 0" + my: "left+15 center", + at: "right center" } }, _create: function() { -- cgit v1.2.3