aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
Diffstat (limited to 'demos')
-rw-r--r--demos/autocomplete/combobox.html13
-rw-r--r--demos/index.html2
-rw-r--r--demos/tooltip/ajax/content1.html1
-rw-r--r--demos/tooltip/ajax/content2.html1
-rw-r--r--demos/tooltip/custom-animation.html55
-rw-r--r--demos/tooltip/default.html48
-rw-r--r--demos/tooltip/delegation-mixbag.html73
-rw-r--r--demos/tooltip/forms.html71
-rw-r--r--demos/tooltip/index.html21
-rw-r--r--demos/tooltip/tracking.html65
10 files changed, 348 insertions, 2 deletions
diff --git a/demos/autocomplete/combobox.html b/demos/autocomplete/combobox.html
index f74f0f106..fd373f0e4 100644
--- a/demos/autocomplete/combobox.html
+++ b/demos/autocomplete/combobox.html
@@ -11,6 +11,7 @@
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.menu.js"></script>
<script src="../../ui/jquery.ui.autocomplete.js"></script>
+ <script src="../../ui/jquery.ui.tooltip.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.ui-button { margin-left: -1px; }
@@ -66,8 +67,10 @@
});
if ( !valid ) {
// remove invalid value, as it didn't match anything
- $( this ).val( "" );
- select.val( "" );
+ $(this).val( "").attr( "title", value + " didn't match any item" ).tooltip( "open" );
+ setTimeout( function() {
+ input.tooltip( "close" ).attr( "title", "" );
+ }, 2500 );
input.data( "autocomplete" ).term = "";
return false;
}
@@ -106,6 +109,12 @@
input.autocomplete( "search", "" );
input.focus();
});
+
+ input.tooltip( {
+ position: {
+ offset: (this.button.width() + 5) + " 0"
+ }
+ }).tooltip( "widget" ).addClass( "ui-state-highlight" );
},
destroy: function() {
diff --git a/demos/index.html b/demos/index.html
index 298803d2f..c249ef1be 100644
--- a/demos/index.html
+++ b/demos/index.html
@@ -28,6 +28,7 @@
<script src="../ui/jquery.ui.sortable.js"></script>
<script src="../ui/jquery.ui.spinner.js"></script>
<script src="../ui/jquery.ui.tabs.js"></script>
+ <script src="../ui/jquery.ui.tooltip.js"></script>
<script src="../ui/jquery.effects.core.js"></script>
<script src="../ui/jquery.effects.blind.js"></script>
<script src="../ui/jquery.effects.bounce.js"></script>
@@ -276,6 +277,7 @@
<dd><a href="slider/index.html">Slider</a></dd>
<dd><a href="spinner/index.html">Spinner</a></dd>
<dd><a href="tabs/index.html">Tabs</a></dd>
+ <dd><a href="tooltip/index.html">Tooltip</a></dd>
<dt>Effects</dt>
<dd><a href="animate/index.html">Color Animation</a></dd>
<dd><a href="toggleClass/index.html">Toggle Class</a></dd>
diff --git a/demos/tooltip/ajax/content1.html b/demos/tooltip/ajax/content1.html
new file mode 100644
index 000000000..a1401b26d
--- /dev/null
+++ b/demos/tooltip/ajax/content1.html
@@ -0,0 +1 @@
+<p><strong>This content was loaded via ajax.</strong></p> \ No newline at end of file
diff --git a/demos/tooltip/ajax/content2.html b/demos/tooltip/ajax/content2.html
new file mode 100644
index 000000000..f4132d731
--- /dev/null
+++ b/demos/tooltip/ajax/content2.html
@@ -0,0 +1 @@
+<p><strong>This other content was loaded via ajax.</strong></p> \ No newline at end of file
diff --git a/demos/tooltip/custom-animation.html b/demos/tooltip/custom-animation.html
new file mode 100644
index 000000000..eb6f3e038
--- /dev/null
+++ b/demos/tooltip/custom-animation.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Tooltip - Custom animation demo</title>
+ <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
+ <script type="text/javascript" src="../../jquery-1.4.4.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
+ <link type="text/css" href="../demos.css" rel="stylesheet" />
+ <script type="text/javascript">
+ $(function() {
+ $(".demo").tooltip({
+ open: function() {
+ $(this).tooltip("widget").stop(false, true).hide().slideDown();
+ },
+ close: function() {
+ $(this).tooltip("widget").stop(false, true).show().slideUp();
+ }
+ });
+ });
+ </script>
+ <style>
+ label { display: inline-block; width: 5em; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+ <p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover
+ the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
+ </p>
+ <p>But as it's not a native tooltip, it can be styled. Any themes built with
+ <a href="http://themeroller.com" title="ThemeRoller, jQuery UI's theme builder application">ThemeRoller</a>
+ will also style tooltip's accordingly.</p>
+ <p>Tooltip's are also useful for form elements, to show some additional information in the context of each field.</p>
+ <p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes." /></p>
+ <p>Click the field to see the tooltip; when you tab out of the field, it gets hidden.</p>
+
+</div><!-- End demo -->
+
+
+
+<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>
+
+</div><!-- End demo-description -->
+
+
+
+</body>
+</html>
diff --git a/demos/tooltip/default.html b/demos/tooltip/default.html
new file mode 100644
index 000000000..a0d61147f
--- /dev/null
+++ b/demos/tooltip/default.html
@@ -0,0 +1,48 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Tooltip - Default demo</title>
+ <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
+ <script type="text/javascript" src="../../jquery-1.4.4.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
+ <link type="text/css" href="../demos.css" rel="stylesheet" />
+ <script type="text/javascript">
+ $(function() {
+ $(".demo").tooltip();
+ });
+ </script>
+ <style>
+ label { display: inline-block; width: 5em; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+ <p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover
+ the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
+ </p>
+ <p>But as it's not a native tooltip, it can be styled. Any themes built with
+ <a href="http://themeroller.com" title="ThemeRoller, jQuery UI's theme builder application">ThemeRoller</a>
+ will also style tooltip's accordingly.</p>
+ <p>Tooltip's are also useful for form elements, to show some additional information in the context of each field.</p>
+ <p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes." /></p>
+ <p>Click the field to see the tooltip; when you tab out of the field, it gets hidden.</p>
+
+</div><!-- End demo -->
+
+
+
+<div class="demo-description">
+
+<p>Hover the links above or use the tab key to cycle the focus on each element.</p>
+
+</div><!-- End demo-description -->
+
+
+
+</body>
+</html>
diff --git a/demos/tooltip/delegation-mixbag.html b/demos/tooltip/delegation-mixbag.html
new file mode 100644
index 000000000..05d3e0fc9
--- /dev/null
+++ b/demos/tooltip/delegation-mixbag.html
@@ -0,0 +1,73 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Tooltip - Default demo</title>
+ <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
+ <script type="text/javascript" src="../../jquery-1.4.4.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
+ <link type="text/css" href="../demos.css" rel="stylesheet" />
+ <script type="text/javascript">
+ $(function() {
+ $(".demo").tooltip({
+ items: "[href], [title]",
+ content: function(response) {
+ var href = $(this).attr("href");
+ if (/^#/.test(href)) {
+ return $(href).html();
+ } else if (href) {
+ $.get(href, response);
+ return "loading...";
+ }
+ return this.title;
+ }
+ });
+ $("#footnotes").hide();
+ });
+ </script>
+ <style>
+ label { display: inline-block; width: 5em; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+ <ul>
+ <li>
+ <a href="#footnote1">I'm a link to a footnote.</a>
+ </li>
+ <li>
+ <a href="#footnote2">I'm another link to a footnote.</a>
+ </li>
+ </ul>
+ <input title="This is just an input, nothing special" />
+
+ <ul>
+ <li>
+ <a href="ajax/content1.html">Link to ajax content, with tooltip preview!</a>
+ </li>
+ <li>
+ <a href="ajax/content2.html">Another link to ajax content, with tooltip preview!</a>
+ </li>
+ </ul>
+
+ <div id="footnotes">
+ <div id="footnote1">This is <strong>the</strong> footnote, including other elements</div>
+ <div id="footnote2">This is <strong>the other</strong> footnote, including other elements</div>
+ </div>
+</div><!-- End demo -->
+
+
+
+<div class="demo-description">
+
+<p>Show how to combine different event delegated tooltips into a single instance, by customizing the items and content options.</p>
+
+</div><!-- End demo-description -->
+
+
+
+</body>
+</html>
diff --git a/demos/tooltip/forms.html b/demos/tooltip/forms.html
new file mode 100644
index 000000000..46ab4e9dc
--- /dev/null
+++ b/demos/tooltip/forms.html
@@ -0,0 +1,71 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Tooltip - Default demo</title>
+ <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
+ <script type="text/javascript" src="../../jquery-1.4.4.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
+ <link type="text/css" href="../demos.css" rel="stylesheet" />
+ <script type="text/javascript">
+ $(function() {
+ $("[title]").tooltip().unbind(".tooltip");
+ $("<button/>").text("Show help").button().toggle(function() {
+ $(":ui-tooltip").tooltip("open");
+ }, function() {
+ $(":ui-tooltip").tooltip("close");
+ }).appendTo("form");
+ });
+ </script>
+ <style>
+ label { display: inline-block; width: 5em; }
+ .ui-icon { display: inline-block; }
+ fieldset div {
+ margin-bottom: 2em;
+ }
+ .ui-tooltip { width: 210px; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+ <form>
+ <fieldset>
+ <div>
+ <label for="firstname">Firstname</label>
+ <input id="firstname" name="firstname" />
+ <span title="Please provide your firstname." class="ui-state-default ui-corner-all ui-icon ui-icon-help">?</span>
+ </div>
+ <div>
+ <label for="lastname">Lastname</label>
+ <input id="lastname" name="lastname" />
+ <span title="Please provide also your lastname." class="ui-state-default ui-corner-all ui-icon ui-icon-help">?</span>
+ </div>
+ <div>
+ <label for="address">Address</label>
+ <input id="address" name="address" />
+ <span title="Your home or work address." class="ui-state-default ui-corner-all ui-icon ui-icon-help">?</span>
+ </div>
+ </fieldset>
+ </form>
+
+</div><!-- End demo -->
+
+
+
+<div class="demo-description">
+
+<p>Use the button below to display the help texts. Click again to hide them. Default hover and focus events are removed to show tooltip only programmatically.</p>
+
+<p>A fixed width is defined in CSS to make the tooltips look consistent when displayed all at once.</p>
+
+</div><!-- End demo-description -->
+
+
+
+</body>
+</html>
diff --git a/demos/tooltip/index.html b/demos/tooltip/index.html
new file mode 100644
index 000000000..6bc9c1e5c
--- /dev/null
+++ b/demos/tooltip/index.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Tooltip Demos</title>
+ <link type="text/css" href="../demos.css" rel="stylesheet" />
+</head>
+<body>
+
+<div class="demos-nav">
+ <h4>Examples</h4>
+ <ul>
+ <li class="demo-config-on"><a href="default.html">Default functionality</a></li>
+ <li><a href="forms.html">Forms with tooltips</a></li>
+ <li><a href="tracking.html">Track the mouse</a></li>
+ <li><a href="custom-animation.html">Custom animation</a></li>
+ <li><a href="delegation-mixbag.html">Delegation Mixbag</a></li>
+ </ul>
+</div>
+
+</body>
+</html>
diff --git a/demos/tooltip/tracking.html b/demos/tooltip/tracking.html
new file mode 100644
index 000000000..495d1aca9
--- /dev/null
+++ b/demos/tooltip/tracking.html
@@ -0,0 +1,65 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Tooltip - Default demo</title>
+ <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
+ <script type="text/javascript" src="../../jquery-1.4.4.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
+ <link type="text/css" href="../demos.css" rel="stylesheet" />
+ <script type="text/javascript">
+ $(function() {
+ $(".demo").tooltip({
+ open: function() {
+ var tooltip = $(this).tooltip("widget");
+ $(document).mousemove(function(event) {
+ tooltip.position({
+ my: "left center",
+ at: "right center",
+ offset: "25 25",
+ of: event
+ });
+ })
+ // trigger once to override element-relative positioning
+ .mousemove();
+ },
+ close: function() {
+ $(document).unbind("mousemove");
+ }
+ });
+ });
+ </script>
+ <style>
+ label { display: inline-block; width: 5em; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+ <p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover
+ the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
+ </p>
+ <p>But as it's not a native tooltip, it can be styled. Any themes built with
+ <a href="http://themeroller.com" title="ThemeRoller, jQuery UI's theme builder application">ThemeRoller</a>
+ will also style tooltip's accordingly.</p>
+ <p>Tooltip's are also useful for form elements, to show some additional information in the context of each field.</p>
+ <p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes." /></p>
+ <p>Click the field to see the tooltip; when you tab out of the field, it gets hidden.</p>
+
+</div><!-- End demo -->
+
+
+
+<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>
+
+</div><!-- End demo-description -->
+
+
+
+</body>
+</html>