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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tabs Demo</title>
<link rel="stylesheet" href="../themes/flora/flora.all.css" type="text/css" media="screen" title="Flora (Default)" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script src="../jquery-1.2.3.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../jquery.dimensions.js"></script>
<script type="text/javascript" src="../ui.tabs.js"></script>
</head>
<body class="flora">
<h1>Simple Tabs</h1>
<div id="container-1">
<ul>
<li><a href="#fragment-1"><span>One</span></a></li>
<li><a href="#fragment-2"><span>Two</span></a></li>
<li><a href="#fragment-3"><span>Three</span></a></li>
</ul>
<div id="fragment-1">
<p>First tab is active by default:</p>
<pre><code>$('#container-1 > ul').tabs();</code></pre>
</div>
<div id="fragment-2">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-3">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
<h1>Start With Custom Tab</h1>
<div id="container-2">
<ul>
<li><a href="#fragment-4"><span>One</span></a></li>
<li><a href="#fragment-5"><span>Two</span></a></li>
<li><a href="#fragment-6"><span>Three</span></a></li>
</ul>
<div id="fragment-4">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-5">
<p>Second tab is active:</p>
<pre><code>$('#container-2 > ul').tabs({ selected: 1 });</code></pre>
<p>
Alternative ways to specify the active tab will overrule this argument, listed in the order of their precedence:</p>
<ol>
<li>If a fragment identifier (hash) in the URL of the page refers to the id of a tab panel of a tab interface the corresponding tab will become the initial tab.</li>
<li>Same if you use the cookie option to save the latest selected tab in.</li>
<li>Last not least you can set the selected tab by attaching the selected tab class
class (default: "ui-tabs-selected") to one of the <code>li</code> elements
representing a single tab.</li>
</ol>
</div>
<div id="fragment-6">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
<h1>Slide Effect</h1>
<div id="container-3">
<ul>
<li><a href="#fragment-7"><span>One</span></a></li>
<li><a href="#fragment-8"><span>Two</span></a></li>
<li><a href="#fragment-9"><span>Three</span></a></li>
</ul>
<div id="fragment-7">
<p>
Use a slide effect to switch tabs.
You can optionally specify the speed for the animation with the option <code>fxSpeed: value</code>.
The value is either a string of one of the predefined speeds in jQuery (<code>slow</code>,
<code>normal</code>, <code>fast</code>) or an integer value specifying the duration for the animation
in milliseconds. If omitted it defaults to <code>normal</code>.
</p>
<pre><code>$('#container-3 > ul').tabs({ fx: { height: 'toggle' } });</code></pre>
</div>
<div id="fragment-8">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-9">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
<h1>Fade Effect</h1>
<div id="container-4">
<ul>
<li><a href="#fragment-10"><span>One</span></a></li>
<li><a href="#fragment-11"><span>Two</span></a></li>
<li><a href="#fragment-12"><span>Three</span></a></li>
</ul>
<div id="fragment-10">
<p>
Use a fade effect to switch tabs.
You can optionally specify the speed for the animation with the option <code>fxSpeed: value</code>.
The value is either a string of one of the predefined speeds in jQuery (<code>slow</code>,
<code>normal</code>, <code>fast</code>) or an integer value specifying the duration for the animation
in milliseconds. If omitted it defaults to <code>normal</code>.
</p>
<pre><code>$('#container-4 > ul').tabs({ fx: { opacity: 'toggle' } });</code></pre>
</div>
<div id="fragment-11">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-12">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
<h1>Slide and Fade Effect Combined</h1>
<div id="container-5">
<ul>
<li><a href="#fragment-13"><span>One</span></a></li>
<li><a href="#fragment-14"><span>Two</span></a></li>
<li><a href="#fragment-15"><span>Three</span></a></li>
</ul>
<div id="fragment-13">
<p>Use a combined slide and fade effect to switch tabs:</p>
<pre><code>$('#container-5 > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });</code></pre>
</div>
<div id="fragment-14">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-15">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
<h1>Callbacks</h1>
<div id="container-6">
<ul>
<li><a href="#fragment-16"><span>One</span></a></li>
<li><a href="#fragment-17"><span>Two</span></a></li>
<li><a href="#fragment-18"><span>Three</span></a></li>
</ul>
<div id="fragment-16">
<p>
Define callback functions that are invoked at different points in time during the tab switch process.
<br />
If the select callback returns false, the clicked tab won't be selected. This is useful if switching
tabs requires form validation before for example.
</p>
<pre><code>$('#container-6 > ul').tabs({ fx: { opacity: 'toggle', duration: 'fast' } })
.bind('select.ui-tabs', function(e, ui) {
alert('event: ' + e.type);
})
.bind('show.ui-tabs', function(e, ui) {
alert('event: ' + e.type);
});</code></pre>
</div>
<div id="fragment-17">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-18">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
<h1>Custom animation</h1>
<div id="container-7">
<ul>
<li><a href="#fragment-19"><span>One</span></a></li>
<li><a href="#fragment-20"><span>Two</span></a></li>
<li><a href="#fragment-21"><span>Three</span></a></li>
</ul>
<div id="fragment-19">
<p>Define your own custom animation:</p>
<pre><code>$('#container-7 > ul').tabs({ fx: [null, { height: 'show', opacity: 'show' }] });</code></pre>
</div>
<div id="fragment-20">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-21">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
<h1>Ajax tabs</h1>
<div id="container-8">
<ul>
<li><a href="ui.tabs.ahah.html" title="Tab one"><span>One</span></a></li>
<li><a href="ui.tabs.ahah.html" title="Tab two"><span>Two</span></a></li>
<li><a href="ui.tabs.ahah.html"><span>Three</span></a></li>
</ul>
</div>
<h1>Triggering, Enabling, Disabling, Adding and Removing Tabs</h1>
<div id="container-9">
<ul>
<li><a href="#fragment-22"><span>One</span></a></li>
<li><a href="#fragment-23"><span>Two</span></a></li>
<li><a href="#fragment-24"><span>Three</span></a></li>
</ul>
<div id="fragment-22">
<pre><code>$('#container-9 > ul').tabs('select', 2); // simulate click on 3rd tab
$('#container-9 > ul').tabs('enable', 2); // enable 3rd tab
$('#container-9 > ul').tabs('disable, 2); // disable 3rd tab
$('#container-9 > ul').tabs('add', '#new-tab', 'New Tab'); // add new tab at the end
$('#container-9 > ul').tabs('add', '#new-tab', 'New Tab', 1); // add new tab at 2nd position
$('#container-9 > ul').tabs('remove', 3); // remove 4th tab</code></pre>
<p>
One or more tabs can also be disabled immediatly by simply setting the disabling class for the <code class="html">li</code> element
representing that particular tab:
</p>
<pre><code class="html"><li class="ui-tabs-disabled">…</li></code></pre>
<p>Or by using the <code>disabled</code> option:</p>
<pre><code class="javascript">$('#container-9 > ul').tabs({ disabled: [1, 2] });</code></pre>
</div>
<div id="fragment-23">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-24">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
<h1>Start with all tabs unselected/allow toggle visibility</h1>
<div id="container-10">
<ul>
<li><a href="#fragment-25"><span>One</span></a></li>
<li><a href="#fragment-26"><span>Two</span></a></li>
<li><a href="#fragment-27"><span>Three</span></a></li>
</ul>
<div id="fragment-25">
<pre><code>$('#container-10 > ul').tabs({ selected: null }); // start with all tabs hidden
$('#container-10 > ul').tabs({ unselect: true }); // selected tab closes on click</code></pre>
<p>
Setting <code class="javascript">selected</code> option to <code class="javascript">null</code> automatically sets <code class="javascript">unselect</code> to true.
</p>
</div>
<div id="fragment-26">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-27">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
<h1>Custom event</h1>
<div id="container-11">
<ul>
<li><a href="#fragment-28"><span>One</span></a></li>
<li><a href="#fragment-29"><span>Two</span></a></li>
<li><a href="#fragment-30"><span>Three</span></a></li>
</ul>
<div id="fragment-28">
<p>Define mouseover event to switch tabs (or any other reasonable event)</p>
<pre><code>$('#container-11 > ul').tabs({ event: 'mouseover' });</code></pre>
</div>
<div id="fragment-29">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-30">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
<script type="text/javascript">
// <![CDATA[
$(window).bind('load', function() {
$('#container-1 > ul').tabs();
$('#container-2 > ul').tabs({ selected: 1 });
$('#container-3 > ul').tabs({ fx: { height: 'toggle' } });
$('#container-4 > ul').tabs({ fx: { opacity: 'toggle' } });
$('#container-5 > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
$('#container-6 > ul').tabs({ fx: { opacity: 'toggle', duration: 'fast' } })
.bind('select.ui-tabs', function(e, ui) {
alert('event: ' + e.type);
})
.bind('show.ui-tabs', function(e, ui) {
alert('event: ' + e.type);
});
$('#container-7 > ul').tabs({ fx: [null, { height: 'show', opacity: 'show' }] });
$('#container-8 > ul').tabs();
$('#container-9 > ul').tabs({ disabled: [2] });
$('<p><a href="#">Remove 4th tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
$('#container-9 > ul').tabs('remove', 3);
return false;
});
$('<p><a href="#">Insert new tab at 2nd position<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
$('#container-9 > ul').tabs('add', '#inserted-tab', 'New Tab', 1);
return false;
});
$('<p><a href="#">Append new tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
$('#container-9 > ul').tabs('add', '#appended-tab', 'New Tab');
return false;
});
$('<p><a href="#">Disable 3rd tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
$('#container-9 > ul').tabs('disable', 2);
return false;
});
$('<p><a href="#">Enable 3rd tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
$('#container-9 > ul').tabs('enable', 2);
return false;
});
$('<p><a href="#">Select 3rd tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
$('#container-9 > ul').tabs('select', 2);
return false;
});
$('<p><a href="#">Get selected tab<\/a><\/p>').prependTo('#fragment-22').find('a').click(function() {
alert( $('#container-9 > ul').data('selected.ui-tabs') );
return false;
});
$('#container-10 > ul').tabs({ selected: null });
$('#container-11 > ul').tabs({ event: 'mouseover' });
});
// ]]>
</script>
</body>
</html>
|