github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jquery / jquery-ui

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 537
    • 85
  • Source
  • Commits
  • Network (85)
  • Graphs
  • Tree: e0611de

click here to add a description

click here to add a homepage

  • Switch Branches (7)
    • bind
    • devpreview
    • formcontrols
    • master
    • menu
    • panel
    • tooltip
  • Switch Tags (18)
    • 1.9m1
    • 1.8rc3
    • 1.8rc2
    • 1.8rc1
    • 1.8b1
    • 1.8a2
    • 1.8a1
    • 1.8.2
    • 1.8.1
    • 1.8
    • 1.7
    • 1.6rc6
    • 1.6rc5
    • 1.6rc3
    • 1.6rc2
    • 1.6
    • 1.5.2
    • 1.5.1
  • Comments
  • Contributors
Sending Request…

The official jQuery user interface library. — Read more

  Cancel

http://jqueryui.com/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Merge branch 'tooltip' into devpreview
jzaefferer (author)
Wed May 05 11:40:37 -0700 2010
commit  e0611ded8a60a8daab24
tree    878c3703debfd439f708
parent  008def00bd565d0984c4 parent  99900d57cec7a2b3b4b0
M demos/autocomplete/combobox.html 18 ••••
M demos/button/splitbutton.html 2 ••
M demos/index.html 2 ••
A demos/tooltip/default.html 48 •••••
A demos/tooltip/forms.html 71 •••••
A demos/tooltip/index.html 19 •••••
A demos/tooltip/tracking.html 65 •••••
M tests/unit/index.html 22 ••••
A tests/unit/tooltip/tooltip.html 43 •••••
A tests/unit/tooltip/tooltip_core.js 11 •••••
A tests/unit/tooltip/tooltip_defaults.js 16 •••••
A tests/unit/tooltip/tooltip_events.js 54 •••••
A tests/unit/tooltip/tooltip_methods.js 23 •••••
A tests/unit/tooltip/tooltip_options.js 39 •••••
A tests/unit/tooltip/tooltip_tickets.js 10 •••••
A tests/visual/compound/tabs_tooltips.html 37 •••••
M tests/visual/compound/widgets_in_dialog.html 9 ••••
M tests/visual/index.html 2 ••
A tests/visual/tooltip/ajaxcontent.php 2 ••
A tests/visual/tooltip/callout.html 213 •••••
A tests/visual/tooltip/tooltip.html 149 •••••
M themes/base/jquery.ui.base.css 1 •
A themes/base/jquery.ui.tooltip.css 16 •••••
A ui/jquery.ui.tooltip.js 147 •••••
Txt demos/autocomplete/combobox.html
  • View file @ e0611de
... ...
@@ -10,6 +10,7 @@
10 10
   <script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
11 11
   <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
12 12
   <script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
  13
+  <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
13 14
   <link type="text/css" href="../demos.css" rel="stylesheet" />
14 15
   <style type="text/css">
15 16
     /* TODO shouldn't be necessary */
... ...
@@ -41,8 +42,12 @@
41 42
             delay: 0,
42 43
             change: function(event, ui) {
43 44
               if (!ui.item) {
44  
-                // remove invalid value, as it didn't match anything
45  
-                $(this).val("");
  45
+                var value = this.value;
  46
+                // remove invalid value, as it didn't match anything, and display a hint
  47
+                $(this).val("").attr("title", value + " didn't match any item").tooltip("open");
  48
+                setTimeout(function() {
  49
+                  input.tooltip("close").attr("title", "");
  50
+                }, 2500);
46 51
                 return false;
47 52
               }
48 53
               select.val(ui.item.id);
... ...
@@ -54,7 +59,7 @@
54 59
             minLength: 0
55 60
           })
56 61
           .addClass("ui-widget ui-widget-content ui-corner-left");
57  
-        $("<button>&nbsp;</button>")
  62
+        var button = $("<button>&nbsp;</button>")
58 63
         .attr("tabIndex", -1)
59 64
         .attr("title", "Show All Items")
60 65
         .insertAfter(input)
... ...
@@ -75,6 +80,13 @@
75 80
           input.autocomplete("search", "");
76 81
           input.focus();
77 82
         });
  83
+        
  84
+        input.tooltip({
  85
+          position: {
  86
+            offset: (button.width() + 5) + " 0"
  87
+          },
  88
+          tooltipClass: "ui-state-highlight"
  89
+        });
78 90
       }
79 91
     });
80 92
 
Txt demos/button/splitbutton.html
  • View file @ e0611de
... ...
@@ -49,7 +49,7 @@
49 49
 
50 50
 <div class="demo-description">
51 51
 
52  
-<p>An example of a split button built with two buttons: A plan button with just text, one with only a primary icon
  52
+<p>An example of a split button built with two buttons: A plain button with just text, one with only a primary icon
53 53
 and no text. Both are grouped together in a set.</p>
54 54
 
55 55
 </div><!-- End demo-description -->
Txt demos/index.html
  • View file @ e0611de
... ...
@@ -25,6 +25,7 @@
25 25
   <script type="text/javascript" src="../ui/jquery.ui.slider.js"></script>
26 26
   <script type="text/javascript" src="../ui/jquery.ui.sortable.js"></script>
27 27
   <script type="text/javascript" src="../ui/jquery.ui.tabs.js"></script>
  28
+  <script type="text/javascript" src="../ui/jquery.ui.tooltip.js"></script>
28 29
   <script type="text/javascript" src="../ui/jquery.effects.core.js"></script>
29 30
   <script type="text/javascript" src="../ui/jquery.effects.blind.js"></script>
30 31
   <script type="text/javascript" src="../ui/jquery.effects.bounce.js"></script>
... ...
@@ -268,6 +269,7 @@
268 269
           <dd><a href="progressbar/index.html">Progressbar</a></dd>
269 270
           <dd><a href="slider/index.html">Slider</a></dd>
270 271
           <dd><a href="tabs/index.html">Tabs</a></dd>
  272
+          <dd><a href="tooltip/index.html">Tooltip</a></dd>
271 273
         <dt>Effects</dt>
272 274
           <dd><a href="animate/index.html">Color Animation</a></dd>
273 275
           <dd><a href="toggleClass/index.html">Toggle Class</a></dd>
Txt demos/tooltip/default.html
  • View file @ e0611de
... ...
@@ -0,0 +1,48 @@
  1
+<!doctype html>
  2
+<html lang="en">
  3
+<head>
  4
+  <title>jQuery UI Tooltip - Default demo</title>
  5
+  <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
  6
+  <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
  7
+  <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
  8
+  <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
  9
+  <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
  10
+  <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
  11
+  <link type="text/css" href="../demos.css" rel="stylesheet" />
  12
+  <script type="text/javascript">
  13
+  $(function() {
  14
+    $("a, input").tooltip();
  15
+  });
  16
+  </script>
  17
+  <style>
  18
+    label { display: inline-block; width: 5em; }
  19
+  </style>
  20
+</head>
  21
+<body>
  22
+
  23
+<div class="demo">
  24
+
  25
+  <p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover
  26
+  the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
  27
+  </p>
  28
+  <p>But as it's not a native tooltip, it can be styled. Any themes built with
  29
+  <a href="http://themeroller.com" title="ThemeRoller, jQuery UI's theme builder application">ThemeRoller</a>
  30
+  will also style tooltip's accordingly.</p>
  31
+  <p>Tooltip's are also useful for form elements, to show some additional information in the context of each field.</p>
  32
+  <p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes." /></p>
  33
+  <p>Click the field to see the tooltip; when you tab out of the field, it gets hidden.</p>
  34
+
  35
+</div><!-- End demo -->
  36
+
  37
+
  38
+
  39
+<div class="demo-description">
  40
+
  41
+<p>Hover the links above or use the tab key to cycle the focus on each element.</p>
  42
+
  43
+</div><!-- End demo-description -->
  44
+
  45
+
  46
+
  47
+</body>
  48
+</html>
Txt demos/tooltip/forms.html
  • View file @ e0611de
... ...
@@ -0,0 +1,71 @@
  1
+<!doctype html>
  2
+<html lang="en">
  3
+<head>
  4
+  <title>jQuery UI Tooltip - Default demo</title>
  5
+  <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
  6
+  <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
  7
+  <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
  8
+  <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
  9
+  <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
  10
+  <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
  11
+  <script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
  12
+  <link type="text/css" href="../demos.css" rel="stylesheet" />
  13
+  <script type="text/javascript">
  14
+  $(function() {
  15
+    $("[title]").tooltip();
  16
+    $("<button/>").text("Show help").button().toggle(function() {
  17
+      $(":ui-tooltip").tooltip("open");
  18
+    }, function() {
  19
+      $(":ui-tooltip").tooltip("close");
  20
+    }).appendTo("form");
  21
+  });
  22
+  </script>
  23
+  <style>
  24
+    label { display: inline-block; width: 5em; }
  25
+    .ui-icon { display: inline-block; }
  26
+    fieldset div {
  27
+      margin-bottom: 2em;
  28
+    }
  29
+    .ui-tooltip { width: 210px; }
  30
+  </style>
  31
+</head>
  32
+<body>
  33
+
  34
+<div class="demo">
  35
+
  36
+  <form>
  37
+    <fieldset>
  38
+      <div>
  39
+        <label for="firstname">Firstname</label>
  40
+        <input id="firstname" name="firstname" />
  41
+        <span title="Please provide your firstname." class="ui-state-default ui-corner-all ui-icon ui-icon-help">?</span>
  42
+      </div>
  43
+      <div>
  44
+        <label for="lastname">Lastname</label>
  45
+        <input id="lastname" name="lastname" />
  46
+        <span title="Please provide also your lastname." class="ui-state-default ui-corner-all ui-icon ui-icon-help">?</span>
  47
+      </div>
  48
+      <div>
  49
+        <label for="address">Address</label>
  50
+        <input id="address" name="address" />
  51
+        <span title="Your home or work address." class="ui-state-default ui-corner-all ui-icon ui-icon-help">?</span>
  52
+      </div>
  53
+    </fieldset>
  54
+  </form>
  55
+
  56
+</div><!-- End demo -->
  57
+
  58
+
  59
+
  60
+<div class="demo-description">
  61
+
  62
+<p>Hover the questionmark-buttons or use the button below to display the help texts all at once. Click again to hide them.</p>
  63
+
  64
+<p>A fixed width is defined in CSS to make the tooltips look consistent when displayed all at once.</p>
  65
+
  66
+</div><!-- End demo-description -->
  67
+
  68
+
  69
+
  70
+</body>
  71
+</html>
Txt demos/tooltip/index.html
  • View file @ e0611de
... ...
@@ -0,0 +1,19 @@
  1
+<!doctype html>
  2
+<html lang="en">
  3
+<head>
  4
+  <title>jQuery UI Tooltip Demos</title>
  5
+  <link type="text/css" href="../demos.css" rel="stylesheet" />
  6
+</head>
  7
+<body>
  8
+
  9
+<div class="demos-nav">
  10
+  <h4>Examples</h4>
  11
+  <ul>
  12
+    <li class="demo-config-on"><a href="default.html">Default functionality</a></li>
  13
+    <li><a href="forms.html">Forms with tooltips</a></li>
  14
+    <li><a href="tracking.html">Track the mouse</a></li>
  15
+  </ul>
  16
+</div>
  17
+
  18
+</body>
  19
+</html>
Txt demos/tooltip/tracking.html
  • View file @ e0611de
... ...
@@ -0,0 +1,65 @@
  1
+<!doctype html>
  2
+<html lang="en">
  3
+<head>
  4
+  <title>jQuery UI Tooltip - Default demo</title>
  5
+  <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
  6
+  <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
  7
+  <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
  8
+  <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
  9
+  <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
  10
+  <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
  11
+  <link type="text/css" href="../demos.css" rel="stylesheet" />
  12
+  <script type="text/javascript">
  13
+  $(function() {
  14
+    $("a, input").tooltip({
  15
+      open: function() {
  16
+        var tooltip = $(this).tooltip("widget");
  17
+        $(document).mousemove(function(event) {
  18
+          tooltip.position({
  19
+            my: "left center",
  20
+            at: "right center",
  21
+            offset: "25 25",
  22
+            of: event
  23
+          });
  24
+        })
  25
+        // trigger once to override element-relative positioning
  26
+        .mousemove();
  27
+      },
  28
+      close: function() {
  29
+        $(document).unbind("mousemove");
  30
+      }
  31
+    });
  32
+  });
  33
+  </script>
  34
+  <style>
  35
+    label { display: inline-block; width: 5em; }
  36
+  </style>
  37
+</head>
  38
+<body>
  39
+
  40
+<div class="demo">
  41
+
  42
+  <p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover
  43
+  the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
  44
+  </p>
  45
+  <p>But as it's not a native tooltip, it can be styled. Any themes built with
  46
+  <a href="http://themeroller.com" title="ThemeRoller, jQuery UI's theme builder application">ThemeRoller</a>
  47
+  will also style tooltip's accordingly.</p>
  48
+  <p>Tooltip's are also useful for form elements, to show some additional information in the context of each field.</p>
  49
+  <p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes." /></p>
  50
+  <p>Click the field to see the tooltip; when you tab out of the field, it gets hidden.</p>
  51
+
  52
+</div><!-- End demo -->
  53
+
  54
+
  55
+
  56
+<div class="demo-description">
  57
+
  58
+<p>Here the tooltips are positioned relative to the mouse, and follow the mouse while it moves above the element.</p>
  59
+
  60
+</div><!-- End demo-description -->
  61
+
  62
+
  63
+
  64
+</body>
  65
+</html>
Txt tests/unit/index.html
  • View file @ e0611de
... ...
@@ -19,27 +19,6 @@
19 19
   }
20 20
   </style>
21 21
 
22  
-  <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
23  
-  <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
24  
-  <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
25  
-  <script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
26  
-  <script type="text/javascript" src="../../ui/jquery.ui.accordion.js"></script>
27  
-  <script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
28  
-  <script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
29  
-  <script type="text/javascript" src="../../ui/jquery.ui.datepicker.js"></script>
30  
-  <script type="text/javascript" src="../../ui/jquery.ui.dialog.js"></script>
31  
-  <script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
32  
-  <script type="text/javascript" src="../../ui/jquery.ui.droppable.js"></script>
33  
-  <script type="text/javascript" src="../../ui/jquery.ui.progressbar.js"></script>
34  
-  <script type="text/javascript" src="../../ui/jquery.ui.resizable.js"></script>
35  
-  <script type="text/javascript" src="../../ui/jquery.ui.selectable.js"></script>
36  
-  <script type="text/javascript" src="../../ui/jquery.ui.slider.js"></script>
37  
-  <script type="text/javascript" src="../../ui/jquery.ui.sortable.js"></script>
38  
-  <script type="text/javascript" src="../../ui/jquery.ui.tabs.js"></script>
39  
-
40  
-  <script type="text/javascript" src="../../external/jquery.cookie.js"></script>
41  
-  <script type="text/javascript" src="../jquery.simulate.js"></script>
42  
-
43 22
 </head>
44 23
 <body>
45 24
 
... ...
@@ -69,6 +48,7 @@
69 48
   <li><a href="progressbar/progressbar.html">Progressbar</a></li>
70 49
   <li><a href="slider/slider.html">Slider</a></li>
71 50
   <li><a href="tabs/tabs.html">Tabs</a></li>
  51
+  <li><a href="tooltip/tooltip.html">Tooltip</a></li>
72 52
 </ul>
73 53
 
74 54
 <h2>Utilities</h2>
Txt tests/unit/tooltip/tooltip.html
  • View file @ e0611de
... ...
@@ -0,0 +1,43 @@
  1
+<!DOCTYPE html>
  2
+<html lang="en">
  3
+<head>
  4
+  <meta charset="UTF-8" />
  5
+  <title>jQuery UI Tooltip Test Suite</title>
  6
+
  7
+  <link type="text/css" href="../../../themes/base/jquery.ui.tooltip.css" rel="stylesheet" />
  8
+
  9
+  <script type="text/javascript" src="../../../jquery-1.4.2.js"></script>
  10
+  <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
  11
+  <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
  12
+  <script type="text/javascript" src="../../../ui/jquery.ui.tooltip.js"></script>
  13
+
  14
+  <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
  15
+  <script type="text/javascript" src="../../../external/qunit.js"></script>
  16
+  <script type="text/javascript" src="../../jquery.simulate.js"></script>
  17
+  <script type="text/javascript" src="../testsuite.js"></script>
  18
+  
  19
+  <script type="text/javascript" src="tooltip_core.js"></script>
  20
+  <script type="text/javascript" src="tooltip_defaults.js"></script>
  21
+  <script type="text/javascript" src="tooltip_events.js"></script>
  22
+  <script type="text/javascript" src="tooltip_methods.js"></script>
  23
+  <script type="text/javascript" src="tooltip_options.js"></script>
  24
+  <script type="text/javascript" src="tooltip_tickets.js"></script>
  25
+  
  26
+</head>
  27
+<body>
  28
+
  29
+<h1 id="qunit-header">jQuery UI Tooltip Test Suite</h1>
  30
+<h2 id="qunit-banner"></h2>
  31
+<h2 id="qunit-userAgent"></h2>
  32
+<ol id="qunit-tests">
  33
+</ol>
  34
+
  35
+<div id="main" style="position: absolute; top: -10000px; left: -10000px;">
  36
+  <div>
  37
+    <a id="tooltipped1" href="#" title="anchortitle">anchor</a>
  38
+    <input title="inputtitle" />
  39
+  </div>
  40
+</div>
  41
+
  42
+</body>
  43
+</html>
Txt tests/unit/tooltip/tooltip_core.js
  • View file @ e0611de
... ...
@@ -0,0 +1,11 @@
  1
+/*
  2
+ * tooltip_core.js
  3
+ */
  4
+
  5
+
  6
+(function($) {
  7
+
  8
+module("tooltip: core");
  9
+
  10
+
  11
+})(jQuery);
Txt tests/unit/tooltip/tooltip_defaults.js
  • View file @ e0611de
... ...
@@ -0,0 +1,16 @@
  1
+/*
  2
+ * tooltip_defaults.js
  3
+ */
  4
+
  5
+var tooltip_defaults = {
  6
+  disabled: false,
  7
+  content: $.ui.tooltip.prototype.options.content,
  8
+  tooltipClass: "ui-widget-content",
  9
+  position: {
  10
+    my: "left center",
  11
+    at: "right center",
  12
+    offset: "15 0"
  13
+  }
  14
+};
  15
+
  16
+commonWidgetTests('tooltip', { defaults: tooltip_defaults });
Txt tests/unit/tooltip/tooltip_events.js
  • View file @ e0611de
... ...
@@ -0,0 +1,54 @@
  1
+/*
  2
+ * tooltip_events.js
  3
+ */
  4
+(function($) {
  5
+
  6
+module("tooltip: events");
  7
+
  8
+test("programmatic triggers", function() {
  9
+  expect(2);
  10
+  var e = $("#tooltipped1").tooltip({
  11
+    open: function(event, ui) {
  12
+      same( event.type, "tooltipopen" );
  13
+    },
  14
+    close: function(event, ui) {
  15
+      same( event.type, "tooltipclose" );
  16
+    }
  17
+  });
  18
+  e.tooltip("open").tooltip("close");
  19
+  e.tooltip("destroy");
  20
+});
  21
+
  22
+test("mouse events", function() {
  23
+  expect(4);
  24
+  var e = $("#tooltipped1").tooltip({
  25
+    open: function(event, ui) {
  26
+      same( event.type, "tooltipopen" );
  27
+      same( event.originalEvent.type, "mouseenter" );
  28
+    },
  29
+    close: function(event, ui) {
  30
+      same( event.type, "tooltipclose" );
  31
+      same( event.originalEvent.type, "mouseleave" );
  32
+    }
  33
+  });
  34
+  e.trigger("mouseover").trigger("mouseout");
  35
+  e.tooltip("destroy");
  36
+});
  37
+
  38
+test("focus events", function() {
  39
+  expect(4);
  40
+  var e = $("#tooltipped1").tooltip({
  41
+    open: function(event, ui) {
  42
+      same( event.type, "tooltipopen" );
  43
+      same( event.originalEvent.type, "focus" );
  44
+    },
  45
+    close: function(event, ui) {
  46
+      same( event.type, "tooltipclose" );
  47
+      same( event.originalEvent.type, "blur" );
  48
+    }
  49
+  });
  50
+  e.trigger("focus").trigger("blur");
  51
+  e.tooltip("destroy");
  52
+});
  53
+
  54
+})(jQuery);
Txt tests/unit/tooltip/tooltip_methods.js
  • View file @ e0611de
... ...
@@ -0,0 +1,23 @@
  1
+/*
  2
+ * tooltip_methods.js
  3
+ */
  4
+(function($) {
  5
+
  6
+
  7
+module("tooltip: methods");
  8
+
  9
+test("destroy", function() {
  10
+  var beforeHtml = $("#tooltipped1").parent().html();
  11
+  var afterHtml = $("#tooltipped1").tooltip().tooltip("destroy").parent().html();
  12
+  equal( afterHtml, beforeHtml );
  13
+});
  14
+
  15
+test("open", function() {
  16
+  var e = $("#tooltipped1").tooltip();
  17
+  ok( $(".ui-tooltip").is(":hidden") );
  18
+  e.tooltip("open");
  19
+  ok( $(".ui-tooltip").is(":visible") );
  20
+  $(":ui-tooltip").tooltip("destroy");
  21
+});
  22
+
  23
+})(jQuery);
Txt tests/unit/tooltip/tooltip_options.js
  • View file @ e0611de
... ...
@@ -0,0 +1,39 @@
  1
+/*
  2
+ * tooltip_options.js
  3
+ */
  4
+(function($) {
  5
+
  6
+module("tooltip: options");
  7
+
  8
+function contentTest(name, expected, impl) {
  9
+  test(name, function() {
  10
+    $("#tooltipped1").tooltip({
  11
+      content: impl
  12
+    }).tooltip("open");
  13
+    same( $(".ui-tooltip").text(), expected );
  14
+    $(":ui-tooltip").tooltip("destroy");
  15
+  });
  16
+}
  17
+
  18
+contentTest("content: default", "anchortitle");
  19
+contentTest("content: return string", "customstring", function() {
  20
+  return "customstring";
  21
+});
  22
+contentTest("content: callback string", "customstring2", function(response) {
  23
+  response("customstring2");
  24
+});
  25
+
  26
+test("tooltipClass, default", function() {
  27
+  $("#tooltipped1").tooltip().tooltip("open");
  28
+  same( $(".ui-tooltip").attr("class"), "ui-tooltip ui-widget ui-corner-all ui-widget-content");
  29
+  $(":ui-tooltip").tooltip("destroy");
  30
+});
  31
+test("tooltipClass, custom", function() {
  32
+  $("#tooltipped1").tooltip({
  33
+    tooltipClass: "pretty fancy"
  34
+  }).tooltip("open");
  35
+  same( $(".ui-tooltip").attr("class"), "ui-tooltip ui-widget ui-corner-all pretty fancy");
  36
+  $(":ui-tooltip").tooltip("destroy");
  37
+});
  38
+
  39
+})(jQuery);
Txt tests/unit/tooltip/tooltip_tickets.js
  • View file @ e0611de
... ...
@@ -0,0 +1,10 @@
  1
+/*
  2
+ * tooltip_tickets.js
  3
+ */
  4
+(function($) {
  5
+
  6
+module("tooltip: tickets");
  7
+
  8
+
  9
+
  10
+})(jQuery);
Txt tests/visual/compound/tabs_tooltips.html
  • View file @ e0611de
... ...
@@ -0,0 +1,37 @@
  1
+<!DOCTYPE html>
  2
+<html lang="en">
  3
+<head>
  4
+  <meta charset="UTF-8" />
  5
+  <title>Compound Visual Test : Tabs in Tabs</title>
  6
+  <link rel="stylesheet" href="../visual.css" type="text/css" />
  7
+  <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css">
  8
+  <script type="text/javascript" src="../../../jquery-1.4.2.js"></script>
  9
+  <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
  10
+  <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
  11
+  <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
  12
+  <script type="text/javascript" src="../../../ui/jquery.ui.tooltip.js"></script>
  13
+  <script type="text/javascript" src="../../../ui/jquery.ui.tabs.js"></script>
  14
+  <script type="text/javascript">
  15
+  $(function() {
  16
+    $("#tabs").tabs();
  17
+    $("a").tooltip();
  18
+  });
  19
+  </script>
  20
+</head>
  21
+<body>
  22
+
  23
+<div id="tabs">
  24
+  <ul>
  25
+    <li><a href="#tabs-1" title="first tab tooltip">First</a></li>
  26
+    <li><a href="#tabs-2" title="second tab tooltip">Second</a></li>
  27
+  </ul>
  28
+  <div id="tabs-1">
  29
+    <a href="#" title="title content">label</a>
  30
+  </div>
  31
+  <div id="tabs-2">
  32
+    <a href="#" title="other title content">other label</a>
  33
+  </div>
  34
+</div>
  35
+
  36
+</body>
  37
+</html>
Txt tests/visual/compound/widgets_in_dialog.html
  • View file @ e0611de
... ...
@@ -20,8 +20,11 @@
20 20
   <script type="text/javascript" src="../../../ui/jquery.ui.progressbar.js"></script>
21 21
   <script type="text/javascript" src="../../../ui/jquery.ui.slider.js"></script>
22 22
   <script type="text/javascript" src="../../../ui/jquery.ui.tabs.js"></script>
  23
+  <script type="text/javascript" src="../../../ui/jquery.ui.tooltip.js"></script>
23 24
   <script type="text/javascript">
24 25
   $(function() {
  26
+    $("[title]").tooltip();
  27
+    
25 28
     $("#accordion").accordion();
26 29
     $("#autocomplete").autocomplete({
27 30
       source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"]
... ...
@@ -50,7 +53,7 @@
50 53
       width: 100,
51 54
       height: 75,
52 55
       modal: true
53  
-    })
  56
+    });
54 57
   });
55 58
   </script>
56 59
 </head>
... ...
@@ -76,11 +79,11 @@
76 79
   <input id="datepicker">
77 80
   <button>Another button</button>
78 81
   <div>
79  
-    <label for="progress">Progress: <input id="progress" /></label>
  82
+    <label for="progress">Progress: <input title="The progress we made so far" id="progress" /></label>
80 83
   </div>
81 84
   <div id="progressbar">
82 85
   </div>
83  
-  <div id="slider"></div>
  86
+  <div id="slider" title="Sliding progress..."></div>
84 87
   <div id="tabs">
85 88
     <ul>
86 89
       <li><a href="#tabs-1">First</a></li>
Txt tests/visual/index.html
  • View file @ e0611de
... ...
@@ -21,6 +21,7 @@
21 21
   <li><a href="compound/draggable_accordion.html">Draggable Accordion</a></li>
22 22
   <li><a href="compound/sortable_accordion_sortable_tabs.html">Accordion within Tabs, both Sortable</a></li>
23 23
   <li><a href="compound/tabs_tabs.html">Tabs contains Tabs</a></li>
  24
+  <li><a href="compound/tabs_tooltips.html">Tabs with Tooltips</a></li>
24 25
   <li><a href="compound/widgets_in_dialog.html">All Widgets within a Dialog</a></li>
25 26
 </ul>
26 27
 
... ...
@@ -44,6 +45,7 @@
44 45
   <li><a href="progressbar/progressbar.html">Progressbar</a></li>
45 46
   <li><a href="slider/slider.html">Slider</a></li>
46 47
   <li><a href="tabs/tabs.html">Tabs</a></li>
  48
+  <li><a href="tooltip/tooltip.html">Tooltip</a></li>
47 49
 </ul>
48 50
 
49 51
 </body>
Txt tests/visual/tooltip/ajaxcontent.php
  • View file @ e0611de
... ...
@@ -0,0 +1,2 @@
  1
+<?php sleep(1); ?>
  2
+<strong>Hello</strong> world!
0 3
\ No newline at end of file
Txt tests/visual/tooltip/callout.html
  • View file @ e0611de
... ...
@@ -0,0 +1,213 @@
  1
+<!DOCTYPE html>
  2
+<html lang="en">
  3
+<head>
  4
+  <title>Tooltip Visual Test: Default</title>
  5
+  <link rel="stylesheet" href="../visual.css" type="text/css" />
  6
+  <link rel="stylesheet" href="../../../themes/base/ui.all.css" type="text/css">
  7
+  <script type="text/javascript" src="../../../jquery-1.3.2.js"></script>
  8
+  <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
  9
+  <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
  10
+  <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
  11
+  <script type="text/javascript" src="../../../ui/jquery.ui.tooltip.js"></script>
  12
+  <script type="text/javascript">
  13
+  $.widget("ui.callout", {
  14
+    _init: function() {
  15
+      this.element.append('<div class="ui-tooltip-pointer ui-widget-content"><div class="ui-tooltip-pointer-inner" style="border-right-color:rgb(255, 255, 255)"></div></div>');
  16
+    },
  17
+    pointAt: function(target) {
  18
+      target = $(target);
  19
+      var tx = target.offset().left + target.width() / 2,
  20
+        ty = target.offset().top + target.height() / 2,
  21
+        dx = this.element.offset().left + this.element.width() / 2,
  22
+        dy = this.element.offset().top + this.element.height() / 2;
  23
+      function d(a, b) {
  24
+        return a > b ? a - b : b - a;
  25
+      }
  26
+      this.element.attr("class", this.element.attr("class").replace(/(.+)ui-tooltip-arrow-..(.+)?/, "$1 $2"));
  27
+      if (dx < tx && d(dx, tx) > d(dy, tx)) {
  28
+        this.element.addClass("ui-tooltip-arrow-rc");
  29
+      }
  30
+      if (dx > tx && d(dx, tx) > d(dy, ty)) {
  31
+        this.element.addClass("ui-tooltip-arrow-lc");
  32
+      }
  33
+      if (dy > ty && d(dx, tx) < d(dy, ty)) {
  34
+        this.element.addClass("ui-tooltip-arrow-tc");
  35
+      }
  36
+      if (dy < ty && d(dx, tx) < d(dy, ty)) {
  37
+        this.element.addClass("ui-tooltip-arrow-bc");
  38
+      }
  39
+      
  40
+      // fix inner borders
  41
+      $('.ui-tooltip-pointer-inner', this.element).each(function(){
  42
+        var pt = $(this).parent().parent();
  43
+        var bColor = pt.css('backgroundColor');
  44
+        $(this).css({
  45
+          borderLeftColor: '',
  46
+          borderRightColor: '',
  47
+          borderTopColor: '',
  48
+          borderBottomColor: ''
  49
+        });
  50
+        if(pt.is('.ui-tooltip-arrow-rb,.ui-tooltip-arrow-rc,.ui-tooltip-arrow-rt')){ $(this).css('border-left-color', bColor); }
  51
+        else if(pt.is('.ui-tooltip-arrow-br,.ui-tooltip-arrow-bc,.ui-tooltip-arrow-bl')){ $(this).css('border-top-color', bColor); }
  52
+        else if(pt.is('.ui-tooltip-arrow-lb,.ui-tooltip-arrow-lc,.ui-tooltip-arrow-lt')){ $(this).css('border-right-color', bColor); }
  53
+        else { $(this).css('border-bottom-color', bColor);  }
  54
+      });
  55
+    }
  56
+  });
  57
+    
  58
+  $(function() {
  59
+    $.ui.tooltip.prototype.options.show = function(event, ui) {
  60
+      $(this).tooltip("widget").callout("pointAt", ui.target);
  61
+    }
  62
+    
  63
+    function enable() {
  64
+      // default
  65
+      $("#context1, form input").tooltip();
  66
+      
  67
+      // custom class, replaces ui-widget-content
  68
+      $("#context2").tooltip({
  69
+        tooltipClass: "ui-widget-header"
  70
+      });
  71
+      $("#right1").tooltip({
  72
+        tooltipClass: "ui-state-error"
  73
+      });
  74
+      
  75
+      // synchronous content
  76
+      $("#see-footnote").tooltip({
  77
+        content: function() {
  78
+          return $($(this).attr("href")).html();
  79
+        }
  80
+      });
  81
+      // asynchronous content
  82
+      $("#ajax").tooltip({
  83
+        content: function(response) {
  84
+          $.get("ajaxcontent.html", response);
  85
+        }
  86
+      });
  87
+      
  88
+      // custom position
  89
+      $("#right2").tooltip({
  90
+        position: {
  91
+          my: "center top",
  92
+          at: "center bottom",
  93
+          offset: "0 10"
  94
+        },
  95
+        tooltipClass: "ui-state-highlight"
  96
+      });
  97
+      
  98
+      $(".ui-tooltip").callout();
  99
+    }
  100
+    enable();
  101
+    
  102
+    $("#disable").toggle(function() {
  103
+      $("*").tooltip("disable");
  104
+    }, function() {
  105
+      $("*").tooltip("enable");
  106
+    });
  107
+    $("#toggle").toggle(function() {
  108
+      $("*").tooltip("destroy");
  109
+    }, function() {
  110
+      enable();
  111
+    });
  112
+  });
  113
+  </script>
  114
+  
  115
+  <style>
  116
+    .ui-tooltip .ui-tooltip-pointer,.ui-tooltip .ui-tooltip-pointer-inner { position:absolute; width:0; height:0; background:none; }
  117
+
  118
+    /*top*/
  119
+    .ui-tooltip-arrow-tr .ui-tooltip-pointer,.ui-tooltip-arrow-tc .ui-tooltip-pointer,.ui-tooltip-arrow-tl .ui-tooltip-pointer { top:-14px; border-top:0; border-bottom-width:14px; }
  120
+    .ui-tooltip-arrow-tr .ui-tooltip-pointer { border-left:18px dotted transparent; border-right:0; right:10px; }
  121
+    .ui-tooltip-arrow-tc .ui-tooltip-pointer { border-left:10px dotted transparent; border-right:10px dotted transparent; left:50%; margin-left:-10px; }
  122
+    .ui-tooltip-arrow-tl .ui-tooltip-pointer { border-left:0; border-right:18px dotted transparent; left:10px; }
  123
+    .ui-tooltip-arrow-tr .ui-tooltip-pointer-inner,.ui-tooltip-arrow-tc .ui-tooltip-pointer-inner,.ui-tooltip-arrow-tl .ui-tooltip-pointer-inner { border-bottom:10px solid #fff; bottom:-14px; }
  124
+    .ui-tooltip-arrow-tr .ui-tooltip-pointer-inner { border-left:12px dotted transparent; border-right:0; right:2px; }
  125
+    .ui-tooltip-arrow-tc .ui-tooltip-pointer-inner { border-left:8px dotted transparent; border-right:8px dotted transparent; left:-8px; }
  126
+    .ui-tooltip-arrow-tl .ui-tooltip-pointer-inner { border-left:0; border-right:12px dotted transparent; left:2px; }
  127
+    
  128
+    /*right*/
  129
+    .ui-tooltip-arrow-rb .ui-tooltip-pointer,.ui-tooltip-arrow-rc .ui-tooltip-pointer,.ui-tooltip-arrow-rt .ui-tooltip-pointer { right:-14px; border-right:0; border-left-width:14px; }
  130
+    .ui-tooltip-arrow-rb .ui-tooltip-pointer { border-bottom:0; border-top:18px dotted transparent; bottom:10px; }
  131
+    .ui-tooltip-arrow-rc .ui-tooltip-pointer { border-bottom:10px dotted transparent; border-top:10px dotted transparent; bottom:50%; margin-bottom:-10px; }
  132
+    .ui-tooltip-arrow-rt .ui-tooltip-pointer { border-bottom:18px dotted transparent; border-top:0; top:10px; }
  133
+    .ui-tooltip-arrow-rb .ui-tooltip-pointer-inner,.ui-tooltip-arrow-rc .ui-tooltip-pointer-inner,.ui-tooltip-arrow-rt .ui-tooltip-pointer-inner { border-left:10px solid #fff; left:-14px; }
  134
+    .ui-tooltip-arrow-rb .ui-tooltip-pointer-inner { border-bottom:0; border-top:12px dotted transparent; bottom:2px; }
  135
+    .ui-tooltip-arrow-rc .ui-tooltip-pointer-inner { border-bottom:8px dotted transparent; border-top:8px dotted transparent; bottom:-8px; }
  136
+    .ui-tooltip-arrow-rt .ui-tooltip-pointer-inner { border-bottom:12px dotted transparent; border-top:0; top:2px; }
  137
+    
  138
+    /*bottom*/
  139
+    .ui-tooltip-arrow-br .ui-tooltip-pointer,.ui-tooltip-arrow-bc .ui-tooltip-pointer,.ui-tooltip-arrow-bl .ui-tooltip-pointer { bottom:-14px; border-bottom:0; border-top-width:14px; }
  140
+    .ui-tooltip-arrow-br .ui-tooltip-pointer { border-left:18px dotted transparent; border-right:0; right:10px; }
  141
+    .ui-tooltip-arrow-bc .ui-tooltip-pointer { border-left:10px dotted transparent; border-right:10px dotted transparent; left:50%; margin-left:-10px; }
  142
+    .ui-tooltip-arrow-bl .ui-tooltip-pointer { border-left:0; border-right:18px dotted transparent; left:10px; }
  143
+    .ui-tooltip-arrow-br .ui-tooltip-pointer-inner,.ui-tooltip-arrow-bc .ui-tooltip-pointer-inner,.ui-tooltip-arrow-bl .ui-tooltip-pointer-inner { border-top:10px solid #fff; top:-14px; }
  144
+    .ui-tooltip-arrow-br .ui-tooltip-pointer-inner { border-left:12px dotted transparent; border-right:0; right:2px; }
  145
+    .ui-tooltip-arrow-bc .ui-tooltip-pointer-inner { border-left:8px dotted transparent; border-right:8px dotted transparent; left:-8px; }
  146
+    .ui-tooltip-arrow-bl .ui-tooltip-pointer-inner { border-left:0; border-right:12px dotted transparent; left:2px; }
  147
+    
  148
+    /*left*/
  149
+    .ui-tooltip-arrow-lb .ui-tooltip-pointer,.ui-tooltip-arrow-lc .ui-tooltip-pointer,.ui-tooltip-arrow-lt .ui-tooltip-pointer { left:-14px; border-left:0; border-right-width:14px; }
  150
+    .ui-tooltip-arrow-lb .ui-tooltip-pointer { border-bottom:0; border-top:18px dotted transparent; bottom:10px; }
  151
+    .ui-tooltip-arrow-lc .ui-tooltip-pointer { border-bottom:10px dotted transparent; border-top:10px dotted transparent; bottom:50%; margin-bottom:-10px; }
  152
+    .ui-tooltip-arrow-lt .ui-tooltip-pointer { border-bottom:18px dotted transparent; border-top:0; top:10px; }
  153
+    .ui-tooltip-arrow-lb .ui-tooltip-pointer-inner,.ui-tooltip-arrow-lc .ui-tooltip-pointer-inner,.ui-tooltip-arrow-lt .ui-tooltip-pointer-inner { border-right:10px solid #fff; right:-14px; }
  154
+    .ui-tooltip-arrow-lb .ui-tooltip-pointer-inner { border-bottom:0; border-top:12px dotted transparent; bottom:2px; }
  155
+    .ui-tooltip-arrow-lc .ui-tooltip-pointer-inner { border-bottom:8px dotted transparent; border-top:8px dotted transparent; bottom:-8px; }
  156
+  </style>
  157
+</head>
  158
+<body>
  159
+
  160
+<div style="width:300px">
  161
+  <ul id="context1" class="ui-widget ui-widget-header">
  162
+    <li><a href="#" title="Tooltip text 1">Anchor 1</a></li>
  163
+    <li><a href="#" title="Tooltip text 2">Anchor 2</a></li>
  164
+    <li><a href="#" title="Tooltip text 3">Anchor 3</a></li>
  165
+    <li><a href="#" title="Tooltip text 4 more Tooltip text Tooltip text ">Anchor 4</a></li>
  166
+    <li><a href="#" title="Tooltip text 5 more Tooltip text Tooltip text ">Anchor 5</a></li>
  167
+    <li><a href="#" title="Tooltip text 6 more Tooltip text Tooltip text ">Anchor 6</a></li>
  168
+  </ul>
  169
+
  170
+  <div id="right1" style="position: absolute; right: 1em" title="right aligned element">
  171
+    collision detection should kick in around here
  172
+  </div>
  173
+  
  174
+  <div style="margin: 2em 0">
  175
+    <a id="see-footnote" href="#footnote">I'm a link to a footnote.</a>
  176
+  </div>
  177
+  
  178
+  <div id="right2" style="position: absolute; right: 1em" title="right aligned element with custom position">
  179
+    right aligned with custom position
  180
+  </div>
  181
+  
  182
+  <div id="ajax" style="width: 100px;" class="ui-widget-content" title="never be seen">
  183
+    gets its content via ajax
  184
+  </div>
  185
+  
  186
+  <div id="context2" class="ui-widget ui-widget-content">
  187
+    <span title="something" style="border:1px solid blue">span</span>
  188
+    <div title="something else" style="border:1px solid red;">
  189
+      div
  190
+      <span title="something more" style="border:1px solid green;">nested span</span>
  191
+    </div>
  192
+  </div>
  193
+  
  194
+  <form style="margin: 2em 0;">
  195
+    <div>
  196
+      <label for="first">First Name:</label>
  197
+      <input id="first" title="Your first name is optional" />
  198
+    </div>
  199
+    <div>
  200
+      <label for="last">Last Name:</label>
  201
+      <input id="last" title="Your last name is optional" />
  202
+    </div>
  203
+  </form>
  204
+  
  205
+  <div id="footnote">This is <strong>the</strong> footnote, including other elements</div>
  206
+  
  207
+  <button id="disable">Toggle disabled</button>
  208
+  <button id="toggle">Toggle widget</button>
  209
+</div>
  210
+
  211
+
  212
+</body>
  213
+</html>
Txt tests/visual/tooltip/tooltip.html
  • View file @ e0611de
... ...
@@ -0,0 +1,149 @@
  1
+<!DOCTYPE html>
  2
+<html lang="en">
  3
+<head>
  4
+  <title>Tooltip Visual Test: Default</title>
  5
+  <link rel="stylesheet" href="../visual.css" type="text/css" />
  6
+  <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css">
  7
+  <script type="text/javascript" src="../../../jquery-1.4.2.js"></script>
  8
+  <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
  9
+  <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
  10
+  <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
  11
+  <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>
  12
+  <script type="text/javascript" src="../../../ui/jquery.ui.tooltip.js"></script>
  13
+  <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
  14
+  <script type="text/javascript">
  15
+  $(function() {
  16
+    $.fn.themeswitcher && $('<div/>').css({
  17
+      position: "absolute",
  18
+      right: 10,
  19
+      top: 10
  20
+    }).appendTo(document.body).themeswitcher();
  21
+    
  22
+    function enable() {
  23
+      // default
  24
+      $("#context1 a, form input, #childish").tooltip();
  25
+      
  26
+      // custom class, replaces ui-widget-content
  27
+      $("#context2 [title]").tooltip({
  28
+        tooltipClass: "ui-widget-header"
  29
+      });
  30
+      $("#right1").tooltip({
  31
+        tooltipClass: "ui-state-error"
  32
+      });
  33
+      
  34
+      // synchronous content
  35
+      $("#see-footnote").tooltip({
  36
+        content: function() {
  37
+          return $($(this).attr("href")).html();
  38
+        }
  39
+      });
  40
+      // asynchronous content
  41
+      $("#ajax").tooltip({
  42
+        content: function(response) {
  43
+          $.get("ajaxcontent.php", response);
  44
+          return "Loading...";
  45
+        }
  46
+      });
  47
+      
  48
+      // custom position
  49
+      $("#right2").tooltip({
  50
+        position: {
  51
+          my: "center top",
  52
+          at: "center bottom",
  53
+          offset: "0 10"
  54
+        },
  55
+        tooltipClass: "ui-state-highlight"
  56
+      });
  57
+      
  58
+      $("#button1").button().tooltip();
  59
+      $("#button2").button({
  60
+        icons: {
  61
+          primary: "ui-icon-wrench"
  62
+        }
  63
+      }).tooltip();
  64
+      $("#button3").button({
  65
+        icons: {
  66
+          primary: "ui-icon-wrench"
  67
+        },
  68
+        text: false
  69
+      }).tooltip();
  70
+    }
  71
+    enable();
  72
+    
  73
+    $("#disable").toggle(function() {
  74
+      $("*").tooltip("disable");
  75
+    }, function() {
  76
+      $("*").tooltip("enable");
  77
+    });
  78
+    $("#toggle").toggle(function() {
  79
+      $("*").tooltip("destroy");
  80
+    }, function() {
  81
+      enable();
  82
+    });
  83
+  });
  84
+  </script>
  85
+</head>
  86
+<body>
  87
+
  88
+<div style="width:300px">
  89
+  <ul id="context1" class="ui-widget ui-widget-header">
  90
+    <li><a href="#" title="Tooltip text 1">Anchor 1</a></li>
  91
+    <li><a href="#" title="Tooltip text 2">Anchor 2</a></li>
  92
+    <li><a href="#" title="Tooltip text 3">Anchor 3</a></li>
  93
+    <li><a href="#" title="Tooltip text 4 more Tooltip text Tooltip text ">Anchor 4</a></li>
  94
+    <li><a href="#" title="Tooltip text 5 more Tooltip text Tooltip text ">Anchor 5</a></li>
  95
+    <li><a href="#" title="Tooltip text 6 more Tooltip text Tooltip text ">Anchor 6</a></li>
  96
+  </ul>
  97
+
  98
+  <div id="right1" style="position: absolute; right: 1em" title="right aligned element">
  99
+    collision detection should kick in around here
  100
+  </div>
  101
+  
  102
+  <div style="margin: 2em 0">
  103
+    <a id="see-footnote" href="#footnote">I'm a link to a footnote.</a>
  104
+  </div>
  105
+  
  106
+  <div id="right2" style="position: absolute; right: 1em" title="right aligned element with custom position">
  107
+    right aligned with custom position
  108
+  </div>
  109
+  
  110
+  <div id="ajax" style="width: 100px;" class="ui-widget-content" title="never be seen">
  111
+    gets its content via ajax
  112
+  </div>
  113
+  
  114
+  <div id="context2" class="ui-widget ui-widget-content">
  115
+    <span title="something" style="border:1px solid blue">span</span>
  116
+    <div title="something else" style="border:1px solid red;">
  117
+      div
  118
+      <span title="something more" style="border:1px solid green;">nested span</span>
  119
+    </div>
  120
+  </div>
  121
+  
  122
+  <div id="childish" class="ui-widget ui-widget-content" style="margin: 2em 0; border: 1px solid black;" title="element with child elements">
  123
+    Text in <strong>bold</strong>.
  124
+  </div>
  125
+  
  126
+  <form style="margin: 2em 0;">
  127
+    <div>
  128
+      <label for="first">First Name:</label>
  129
+      <input id="first" title="Your first name is optional" />
  130
+    </div>
  131
+    <div>
  132
+      <label for="last">Last Name:</label>
  133
+      <input id="last" title="Your last name is optional" />
  134
+    </div>
  135
+  </form>
  136
+  
  137
+  <button id="button1" title="Button Tooltip">Button Label</button>
  138
+  <button id="button2" title="Icon Button">Button with Icon</button>
  139
+  <button id="button3">Icon Only Button</button>
  140
+  
  141
+  <div id="footnote">This is <strong>the</strong> footnote, including other elements</div>
  142
+  
  143
+  <button id="disable">Toggle disabled</button>
  144
+  <button id="toggle">Toggle widget</button>
  145
+</div>
  146
+
  147
+
  148
+</body>
  149
+</html>
Txt themes/base/jquery.ui.base.css
  • View file @ e0611de
... ...
@@ -9,3 +9,4 @@
9 9
 @import url("jquery.ui.resizable.css");
10 10
 @import url("jquery.ui.slider.css");
11 11
 @import url("jquery.ui.tabs.css");
  12
+@import url("jquery.ui.tooltip.css");
Txt themes/base/jquery.ui.tooltip.css
  • View file @ e0611de
... ...
@@ -0,0 +1,16 @@
  1
+/* Tooltip
  2
+----------------------------------*/
  3
+.ui-tooltip {
  4
+  padding:8px;
  5
+  position:absolute;
  6
+  z-index:9999;
  7
+  -o-box-shadow: 0 0 5px #aaa;
  8
+  -moz-box-shadow: 0 0 5px #aaa;
  9
+  -webkit-box-shadow: 0 0 5px #aaa;
  10
+  box-shadow: 0 0 5px #aaa;
  11
+}
  12
+/* Fades and background-images don't work well together in IE6, drop the image */
  13
+* html .ui-tooltip {
  14
+  background-image: none;
  15
+}
  16
+body .ui-tooltip { border-width:2px; }
Txt ui/jquery.ui.tooltip.js
  • View file @ e0611de
... ...
@@ -0,0 +1,147 @@
  1
+/*
  2
+ * jQuery UI Tooltip @VERSION
  3
+ *
  4
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
  6
+ * and GPL (GPL-LICENSE.txt) licenses.
  7
+ *
  8
+ * http://docs.jquery.com/UI/Tooltip
  9
+ *
  10
+ * Depends:
  11
+ *  jquery.ui.core.js
  12
+ *  jquery.ui.widget.js
  13
+ *  jquery.ui.position.js
  14
+ */
  15
+(function($) {
  16
+
  17
+// role=application on body required for screenreaders to correctly interpret aria attributes
  18
+if( !$(document.body).is('[role]') ){
  19
+  $(document.body).attr('role','application');
  20
+} 
  21
+
  22
+var increments = 0;
  23
+
  24
+$.widget("ui.tooltip", {
  25
+  options: {
  26
+    tooltipClass: "ui-widget-content",
  27
+    content: function() {
  28
+      return $(this).attr("title");
  29
+    },
  30
+    position: {
  31
+      my: "left center",
  32
+      at: "right center",
  33
+      offset: "15 0"
  34
+    }
  35
+  },
  36
+  _init: function() {
  37
+    var self = this;
  38
+    this.tooltip = $("<div></div>")
  39
+      .attr("id", "ui-tooltip-" + increments++)
  40
+      .attr("role", "tooltip")
  41
+      .attr("aria-hidden", "true")
  42
+      .addClass("ui-tooltip ui-widget ui-corner-all")
  43
+      .addClass(this.options.tooltipClass)
  44
+      .appendTo(document.body)
  45
+      .hide();
  46
+    this.tooltipContent = $("<div></div>")
  47
+      .addClass("ui-tooltip-content")
  48
+      .appendTo(this.tooltip);
  49
+    this.opacity = this.tooltip.css("opacity");
  50
+    this.element
  51
+      .bind("focus.tooltip mouseenter.tooltip", function(event) {
  52
+        self.open( event );
  53
+      })
  54
+      .bind("blur.tooltip mouseleave.tooltip", function(event) {
  55
+        self.close( event );
  56
+      });
  57
+  },
  58
+  
  59
+  enable: function() {
  60
+    this.options.disabled = false;
  61
+  },
  62
+  
  63
+  disable: function() {
  64
+    this.options.disabled = true;
  65
+  },
  66
+  
  67
+  destroy: function() {
  68
+    this.tooltip.remove();
  69
+    $.Widget.prototype.destroy.apply(this, arguments);
  70
+  },
  71
+  
  72
+  widget: function() {
  73
+    return this.tooltip;
  74
+  },
  75
+  
  76
+  open: function(event) {
  77
+    var target = this.element;
  78
+    // already visible? possible when both focus and mouseover events occur
  79
+    if (this.current && this.current[0] == target[0])
  80
+      return;
  81
+    var self = this;
  82
+    this.current = target;
  83
+    this.currentTitle = target.attr("title");
  84
+    var content = this.options.content.call(target[0], function(response) {
  85
+      // ignore async responses that come in after the tooltip is already hidden
  86
+      if (self.current == target)
  87
+        self._show(event, target, response);
  88
+    });
  89
+    if (content) {
  90
+      self._show(event, target, content);
  91
+    }
  92
+  },
  93
+  
  94
+  _show: function(event, target, content) {
  95
+    if (!content)
  96
+      return;
  97
+    
  98
+    target.attr("title", "");
  99
+    
  100
+    if (this.options.disabled)
  101
+      return;
  102
+      
  103
+    this.tooltipContent.html(content);
  104
+    this.tooltip.css({
  105
+      top: 0,
  106
+      left: 0
  107
+    }).position($.extend(this.options.position, {
  108
+      of: target
  109
+    }));
  110
+    
  111
+    this.tooltip.attr("aria-hidden", "false");
  112
+    target.attr("aria-describedby", this.tooltip.attr("id"));
  113
+
  114
+    if (this.tooltip.is(":animated"))
  115
+      this.tooltip.stop().show().fadeTo("normal", this.opacity);
  116
+    else
  117
+      this.tooltip.is(':visible') ? this.tooltip.fadeTo("normal", this.opacity) : this.tooltip.fadeIn();
  118
+
  119
+    this._trigger( "open", event );
  120
+  },
  121
+  
  122
+  close: function(event) {
  123
+    if (!this.current)
  124
+      return;
  125
+    
  126
+    var current = this.current.attr("title", this.currentTitle);
  127
+    this.current = null;
  128
+    
  129
+    if (this.options.disabled)
  130
+      return;
  131
+    
  132
+    current.removeAttr("aria-describedby");
  133
+    this.tooltip.attr("aria-hidden", "true");
  134
+    
  135
+    if (this.tooltip.is(':animated'))
  136
+        this.tooltip.stop().fadeTo("normal", 0, function() {
  137
+          $(this).hide().css("opacity", "");
  138
+        });
  139
+      else
  140
+        this.tooltip.stop().fadeOut();
  141
+    
  142
+    this._trigger( "close", event );
  143
+  }
  144
+  
  145
+});
  146
+
  147
+})(jQuery);
0 148
\ No newline at end of file

0 notes on commit e0611de

Please log in to comment.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server