1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tooltip Visual Test: Default</title>
<link rel="stylesheet" href="../../../themes/base/all.css">
<script src="../../../external/jquery/jquery.js"></script>
<script src="../../../ui/core.js"></script>
<script src="../../../ui/widget.js"></script>
<script src="../../../ui/position.js"></script>
<script src="../../../ui/button.js"></script>
<script src="../../../ui/tooltip.js"></script>
<style>
.group {
margin-top: 2em;
}
</style>
<script>
$(function() {
// default
$( "#context1, form, #childish, #nested-input" ).tooltip();
// custom class, replaces ui-widget-content
$( "#context2" ).tooltip({
classes: {
"ui-tooltip": "ui-corner-all ui-widget-header"
}
});
$( "#right1" ).tooltip({
classes: {
"ui-tooltip": "ui-corner-all ui-state-error"
}
});
// synchronous content
$( "#footnotes" ).tooltip({
items: "[href^='#']",
content: function() {
return $( $( this ).attr( "href" ) ).html();
}
});
// asynchronous content
$( "#async" ).tooltip({
content: function( response ) {
setTimeout(function() {
response( "I loaded <strong>asynchronously</strong>!" );
}, 1000 );
return "Loading...";
}
});
// asynchronous content with caching
var content;
$( "#async2" ).tooltip({
content: function( response ) {
if ( content ) {
return content;
}
setTimeout(function() {
content = "<strong>Hello</strong> world!";
response( content );
}, 1000 );
return "Loading...";
}
});
// custom position
$( "#right2" ).tooltip({
classes: {
"ui-tooltip": "ui-corner-all ui-state-highlight"
},
position: {
my: "center top",
at: "center bottom+10"
}
});
$( "#button1" ).button();
$( "#button2" ).button({
icons: {
primary: "ui-icon-wrench"
}
});
$( "#button3, #button4" ).button({
icons: {
primary: "ui-icon-wrench"
},
text: false
});
$( "#buttons" ).tooltip({
position: {
my: "center bottom",
at: "center top-5"
}
});
$( "#blurs-on-click" ).tooltip({
track: true,
show: {
delay: 500
}
}).on( "click", function() {
$( "#focus-on-me" ).trigger( "focus" );
});
});
</script>
</head>
<body>
<div>
<p>Lots of tooltipped elements close together.<br>
Mouse through them quickly and slowly.</p>
<ul id="context1">
<li><a href="#" title="Tooltip text 1">Anchor 1</a></li>
<li><a href="#" title="Tooltip text 2">Anchor 2</a></li>
<li><a href="#" title="Tooltip text 3">Anchor 3</a></li>
<li><a href="#" title="Tooltip text 4 more Tooltip text Tooltip text ">Anchor 4</a></li>
<li><a href="#" title="Tooltip text 5 more Tooltip text Tooltip text ">Anchor 5</a></li>
<li><a href="#" title="Tooltip text 6 more Tooltip text Tooltip text ">Anchor 6</a></li>
</ul>
<div class="group" style="position: absolute; right: 1em; text-align: right;">
<p>These elements are right aligned.<br>
One collides and one uses custom position.</p>
<p id="right1" title="right aligned element">
collision detection should kick in around here
</p>
<p id="right2" title="right aligned element with custom position">
right aligned with custom position
</p>
</div>
<div class="group">
<p>These footnotes pull content form the elements they link to.</p>
<div id="footnotes">
<a href="#footnote1">I'm a link to a footnote.</a>
<a href="#footnote2">I'm another link to a footnote.</a>
</div>
</div>
<div class="group">
<p>These elements load their content asynchronously.<br>
There should be a loading message while the content is retrieved.</p>
<div id="async" style="width: 100px;" class="ui-widget-content" title="never be seen">
async
</div>
<div id="async2" style="width: 100px;" class="ui-widget-content" title="never be seen">
async + cache
</div>
</div>
<div class="group" style="width: 300px;">
<p>Nested elements.</p>
<div id="context2">
<div title="nested parent" style="border:1px solid red;">
tooltipped
<span title="nested child" style="border:1px solid green; padding-left: 25px;">
nested tooltipped
<span title="nested nested child" style="border:1px solid blue; padding-left: 25px;">third level</span>
</span>
</div>
<input title="nested input title">
</div>
<div id="childish" style="border: 1px solid black;" title="element with child elements">
Text in <strong>bold</strong>.
</div>
</div>
<button id="blurs-on-click" title="button title text">click me to focus something else</button
|