diff options
author | jzaefferer <joern.zaefferer@gmail.com> | 2011-04-13 14:01:46 +0200 |
---|---|---|
committer | jzaefferer <joern.zaefferer@gmail.com> | 2011-04-13 14:01:46 +0200 |
commit | 67d49f593bb34f10751421a51c8e13d42bc1b16e (patch) | |
tree | cca067334b672af9a8d1b85dbc008a04e0c8c63f /tests/visual/tooltip | |
parent | bc65675330e758c406098e929ee8b4c1741c87fd (diff) | |
download | jquery-ui-67d49f593bb34f10751421a51c8e13d42bc1b16e.tar.gz jquery-ui-67d49f593bb34f10751421a51c8e13d42bc1b16e.zip |
Overhaul tooltip implementation. Avoid queuing and other problems by
creating the tooltip element on the fly, never reusing it.
Use aria-describedby attribute to find the associated tooltip again.
Allows customizing animations much easier (just replace fadeIn/fadeOut),
still open.
Updated demos and visual test to replace now-missing .widget() method.
Added tooltipClass for that.
Diffstat (limited to 'tests/visual/tooltip')
-rw-r--r-- | tests/visual/tooltip/tooltip.html | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tests/visual/tooltip/tooltip.html b/tests/visual/tooltip/tooltip.html index 538b43804..70c850b60 100644 --- a/tests/visual/tooltip/tooltip.html +++ b/tests/visual/tooltip/tooltip.html @@ -10,7 +10,9 @@ <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script> <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script> <script type="text/javascript" src="../../../ui/jquery.ui.tooltip.js"></script> + <!-- <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script> + --> <script type="text/javascript"> $(function() { $.fn.themeswitcher && $('<div/>').css({ @@ -18,20 +20,22 @@ right: 10, top: 10 }).appendTo(document.body).themeswitcher(); - + function enable() { // default $("#context1, form, #childish").tooltip(); // custom class, replaces ui-widget-content - $("#context2").tooltip().each(function() { - $(this).tooltip("widget").addClass("ui-widget-header"); - }) - $("#right1").tooltip().tooltip("widget").addClass("ui-state-error"); + $("#context2").tooltip({ + tooltipClass: "ui-widget-header" + }); + $("#right1").tooltip({ + tooltipClass: "ui-state-error" + }); // synchronous content $("#footnotes").tooltip({ - items: "[href^=#]", + items: "[href^='#']", content: function() { return $($(this).attr("href")).html(); } @@ -64,12 +68,13 @@ // custom position $("#right2").tooltip({ + tooltipClass: "ui-state-highlight", position: { my: "center top", at: "center bottom", offset: "0 10" } - }).tooltip("widget").addClass("ui-state-highlight"); + }); $("#button1").button(); $("#button2").button({ @@ -94,12 +99,12 @@ enable(); $("#disable").toggle(function() { - $("*").tooltip("disable"); + $(":ui-tooltip").tooltip("disable"); }, function() { - $("*").tooltip("enable"); + $(":ui-tooltip").tooltip("enable"); }); $("#toggle").toggle(function() { - $("*").tooltip("destroy"); + $(":ui-tooltip").tooltip("destroy"); }, function() { enable(); }); |