Skip to content

Commit 4d6770f

Browse files
committed
Tooltip: Added demo for custom animations
1 parent 615022a commit 4d6770f

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

demos/tooltip/custom-animation.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<title>jQuery UI Tooltip - Custom animation 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+
$(this).tooltip("widget").stop(false, true).hide().slideDown();
17+
},
18+
close: function() {
19+
$(this).tooltip("widget").stop(false, true).show().slideUp();
20+
}
21+
});
22+
});
23+
</script>
24+
<style>
25+
label { display: inline-block; width: 5em; }
26+
</style>
27+
</head>
28+
<body>
29+
30+
<div class="demo">
31+
32+
<p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover
33+
the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
34+
</p>
35+
<p>But as it's not a native tooltip, it can be styled. Any themes built with
36+
<a href="http://themeroller.com" title="ThemeRoller, jQuery UI's theme builder application">ThemeRoller</a>
37+
will also style tooltip's accordingly.</p>
38+
<p>Tooltip's are also useful for form elements, to show some additional information in the context of each field.</p>
39+
<p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes." /></p>
40+
<p>Click the field to see the tooltip; when you tab out of the field, it gets hidden.</p>
41+
42+
</div><!-- End demo -->
43+
44+
45+
46+
<div class="demo-description">
47+
48+
<p>Here the tooltips are positioned relative to the mouse, and follow the mouse while it moves above the element.</p>
49+
50+
</div><!-- End demo-description -->
51+
52+
53+
54+
</body>
55+
</html>

demos/tooltip/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ <h4>Examples</h4>
1212
<li class="demo-config-on"><a href="default.html">Default functionality</a></li>
1313
<li><a href="forms.html">Forms with tooltips</a></li>
1414
<li><a href="tracking.html">Track the mouse</a></li>
15+
<li><a href="custom-animation.html">Custom animation</a></li>
1516
</ul>
1617
</div>
1718

0 commit comments

Comments
 (0)