Skip to content

Commit 3bb9ab2

Browse files
committed
Tooltip: Add support for delaying showing/hiding. Still need to figure
out how to combine that with non-animated show/hide.
1 parent 3950a05 commit 3bb9ab2

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

demos/tooltip/custom-animation.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
$(function() {
1414
$(".demo").tooltip({
1515
show: {
16-
effect: "slideDown"
16+
effect: "slideDown",
17+
delay: 250
1718
},
1819
hide: {
19-
effect: "slideUp"
20+
effect: "slideUp",
21+
delay: 500
2022
}
2123
});
2224
});

ui/jquery.ui.tooltip.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ $.widget("ui.tooltip", {
9090
of: target
9191
}, this.options.position ) ).hide();
9292

93-
93+
tooltip.stop( true );
9494
this._show( tooltip, this.options.show );
9595

9696
this._trigger( "open", event );
@@ -111,7 +111,7 @@ $.widget("ui.tooltip", {
111111
var tooltip = this._find( target );
112112
target.removeAttr( "aria-describedby" );
113113

114-
tooltip.stop();
114+
tooltip.stop( true );
115115
this._hide( tooltip, this.options.hide, function() {
116116
$( this ).remove();
117117
});

ui/jquery.ui.widget.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,9 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
359359
var hasOptions = !$.isEmptyObject( options ),
360360
effectName = options.effect || defaultEffect;
361361
options.complete = callback;
362-
362+
if (options.delay) {
363+
element.delay( options.delay );
364+
}
363365
if ( hasOptions && $.effects && $.effects[ effectName ] ) {
364366
element[ method ]( options );
365367
} else if ( element[ effectName ] ) {

0 commit comments

Comments
 (0)