Skip to content

Commit

Permalink
Tooltip: Overhaul widget animations code to allow delay with plain sh…
Browse files Browse the repository at this point in the history
…ow/hide
  • Loading branch information
jzaefferer committed May 2, 2011
1 parent 3bb9ab2 commit a03c222
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
8 changes: 5 additions & 3 deletions demos/tooltip/custom-animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
delay: 250
},
hide: {
effect: "slideUp",
delay: 500
effect: "hide",
delay: 250
}
});
});
Expand Down Expand Up @@ -47,7 +47,9 @@

<div class="demo-description">

<p>Here the tooltips are positioned relative to the mouse, and follow the mouse while it moves above the element.</p>
<p>This demo shows how to customize animations. The tooltip is shown, after a
delay of 250ms, using a slide down animation, and hidden, after another delay,
without an animation.</p>

</div><!-- End demo-description -->

Expand Down
21 changes: 16 additions & 5 deletions ui/jquery.ui.widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,23 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
if ( hasOptions && $.effects && $.effects[ effectName ] ) {
element[ method ]( options );
} else if ( element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
} else {
element[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
if ( /show|hide/.test( effectName ) ) {
element.queue( function() {
element[ effectName ]();
if ( callback ) {
callback.call( element[ 0 ] );
}
});
} else {
element[ effectName ]( options.duration, options.easing, callback );
}
} else {
element.queue( function() {
$( this )[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
}
});
}
};
});
Expand Down

0 comments on commit a03c222

Please sign in to comment.