Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions ui/jquery.ui.tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,27 @@ $.widget("ui.tooltip", {
self._show(event, target, content);
}
},


/**
* used function from this comment http://bugs.jqueryui.com/ticket/3772#comment:6
*/
_animate: function (effect, showing) {
// Convert to array
effect = ($.isArray(effect) ? effect : (typeof effect === 'string' ? [effect] :
[effect.fx, effect.options, effect.speed, effect.callback]));
// Check for options
(effect[1] && typeof effect[1] !== 'object' ? effect.splice(1, 0, null) : effect);
// Check for callback
($.isFunction(effect[2]) ? effect.splice(2, 0, null) : effect);
// Special case for 'show'
effect = (effect[0] && effect[0] !== 'show' ? effect : effect.slice(2));
(effect[0] === 'fade' ?
// Special case for 'fade'
this.tooltip[showing ? 'fadeIn' : 'fadeOut'].apply(this.tooltip, effect.slice(2)) :
// Apply effect
this.tooltip[showing ? 'show' : 'hide'].apply(this.tooltip, effect));
},

_show: function(event, target, content) {
if (!content)
return;
Expand All @@ -107,7 +127,9 @@ $.widget("ui.tooltip", {
this.tooltip.attr("aria-hidden", "false");
target.attr("aria-describedby", this.tooltip.attr("id"));

this.tooltip.stop(false, true).fadeIn();
this.tooltip.stop(false, true);
//animation stuff - if show was not provided -> trigger default fadeIn animation
this._animate( !this.options.show ? 'fade' : this.options.show, 1 );

this._trigger( "open", event );
},
Expand All @@ -125,10 +147,13 @@ $.widget("ui.tooltip", {

current.removeAttr("aria-describedby");
this.tooltip.attr("aria-hidden", "true");
this.tooltip.stop(false, true).fadeOut();


this.tooltip.stop(false, true);
//animation stuff - trigger close event just before animation fired?
this._trigger( "close", event );

//show was not provided -> trigger default fadeIn animation
this._animate( !this.options.hide ? 'fade' : this.options.hide, 0 );
}
});

Expand Down