|
9 | 9 | <script src="../../ui/jquery.ui.widget.js"></script>
|
10 | 10 | <script src="../../ui/jquery.ui.position.js"></script>
|
11 | 11 | <script src="../../ui/jquery.ui.tooltip.js"></script>
|
| 12 | + <script src="../../ui/jquery.effects.core.js"></script> |
| 13 | + <script src="../../ui/jquery.effects.explode.js"></script> |
12 | 14 | <link rel="stylesheet" href="../demos.css">
|
13 |
| - <style> |
14 |
| - label { |
15 |
| - display: inline-block; |
16 |
| - width: 5em; |
17 |
| - } |
18 |
| - </style> |
19 | 15 | <script>
|
20 | 16 | $(function() {
|
21 |
| - $( ".demo" ).tooltip({ |
| 17 | + $( "#show-option" ).tooltip({ |
22 | 18 | show: {
|
23 | 19 | effect: "slideDown",
|
24 | 20 | delay: 250
|
25 |
| - }, |
| 21 | + } |
| 22 | + }); |
| 23 | + $( "#hide-option" ).tooltip({ |
26 | 24 | hide: {
|
27 |
| - effect: "hide", |
| 25 | + effect: "explode", |
28 | 26 | delay: 250
|
29 | 27 | }
|
30 | 28 | });
|
| 29 | + $( "#position-option" ).tooltip({ |
| 30 | + position: { |
| 31 | + my: "left top", |
| 32 | + at: "left bottom+10", |
| 33 | + using: function( pos ) { |
| 34 | + $( this ).css({ |
| 35 | + left: pos.left, |
| 36 | + top: pos.top - 10 |
| 37 | + }).animate({ top: pos.top }, "fast" ); |
| 38 | + } |
| 39 | + } |
| 40 | + }); |
31 | 41 | });
|
32 | 42 | </script>
|
33 | 43 | </head>
|
34 | 44 | <body>
|
35 | 45 |
|
36 | 46 | <div class="demo">
|
37 | 47 |
|
38 |
| -<p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover |
39 |
| -the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.</p> |
40 |
| -<p>But as it's not a native tooltip, it can be styled. Any themes built with |
41 |
| -<a href="http://themeroller.com" title="ThemeRoller: jQuery UI's theme builder application">ThemeRoller</a> |
42 |
| -will also style tooltips accordingly.</p> |
43 |
| -<p>Tooltips are also useful for form elements, to show some additional information in the context of each field.</p> |
44 |
| -<p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes."></p> |
45 |
| -<p>Hover the field to see the tooltip.</p> |
| 48 | +<p>There are various ways to customize the animation of a tooltip.</p> |
| 49 | +<p>You can use the <a id="show-option" href="http://jqueryui.com/demos/tooltip/#option-show" title="show effect">show</a> and |
| 50 | +<a id="hide-option" href="http://jqueryui.com/demos/tooltip/#option-hide" title="hide effect">hide</a> options.</p> |
| 51 | +<p>You can also use the <a id="position-option" href="http://jqueryui.com/demos/tooltip/#option-position" title="position option">position option</a>.</p> |
46 | 52 |
|
47 | 53 | </div><!-- End demo -->
|
48 | 54 |
|
|
0 commit comments