diff options
author | jzaefferer <joern.zaefferer@gmail.com> | 2010-10-21 21:03:48 +0200 |
---|---|---|
committer | jzaefferer <joern.zaefferer@gmail.com> | 2010-10-21 21:03:48 +0200 |
commit | 732a485676a1dcbefc16fdb9d26774b622410138 (patch) | |
tree | 230c7abf756946913df09f9d58cfba7ed5663463 /ui/jquery.ui.tooltip.js | |
parent | 96977edecc134d9212a304a1236e823237e8e274 (diff) | |
download | jquery-ui-732a485676a1dcbefc16fdb9d26774b622410138.tar.gz jquery-ui-732a485676a1dcbefc16fdb9d26774b622410138.zip |
Tooltip: Adding another ajax example to visual testcase. Fixing async response handling (taking IE cached response quirk into account) and simplifying fade animations a ton.
Diffstat (limited to 'ui/jquery.ui.tooltip.js')
-rw-r--r-- | ui/jquery.ui.tooltip.js | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 32d5afeee..8341131ca 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -82,9 +82,12 @@ $.widget("ui.tooltip", { this.current = target; this.currentTitle = target.attr("title"); var content = this.options.content.call(target[0], function(response) { - // ignore async responses that come in after the tooltip is already hidden - if (self.current == target) - self._show(event, target, response); + // IE may instantly serve a cached response, need to give it a chance to finish with _show before that + setTimeout(function() { + // ignore async responses that come in after the tooltip is already hidden + if (self.current == target) + self._show(event, target, response); + }, 13); }); if (content) { self._show(event, target, content); @@ -111,10 +114,7 @@ $.widget("ui.tooltip", { this.tooltip.attr("aria-hidden", "false"); target.attr("aria-describedby", this.tooltip.attr("id")); - if (this.tooltip.is(":animated")) - this.tooltip.stop().show().fadeTo("normal", this.opacity); - else - this.tooltip.is(':visible') ? this.tooltip.fadeTo("normal", this.opacity) : this.tooltip.fadeIn(); + this.tooltip.stop(false, true).fadeIn(); this._trigger( "open", event ); }, @@ -132,12 +132,7 @@ $.widget("ui.tooltip", { current.removeAttr("aria-describedby"); this.tooltip.attr("aria-hidden", "true"); - if (this.tooltip.is(':animated')) - this.tooltip.stop().fadeTo("normal", 0, function() { - $(this).hide().css("opacity", ""); - }); - else - this.tooltip.stop().fadeOut(); + this.tooltip.stop(false, true).fadeOut(); this._trigger( "close", event ); } |