forked from hailwood/jQuery-Tagit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
280 lines (237 loc) · 6.74 KB
/
index.html
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
<!doctype html>
<html>
<head>
<title>jQuery Tagit Demo Page (HTML)</title>
<script src="demo/js/jquery.1.7.2.min.js"></script>
<script src="demo/js/jquery-ui.1.8.20.min.js"></script>
<script src="js/tagit.js"></script>
<link href="demo/css/demo.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="demo/css/jquery-ui-base-1.8.20.css">
<link rel="stylesheet" type="text/css" href="css/tagit-stylish-yellow.css">
<script>
$(function () {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$('#demo1').tagit({tagSource:availableTags, select:true, sortable:true});
$('#demo2').tagit({tagSource:availableTags, placeholder: "Enter a programming language", inputWidth: 180});
$('#demo3').tagit({tagSource:availableTags, triggerKeys:['enter', 'comma', 'tab']});
$('#demo4').tagit({tagSource:availableTags, sortable:true, tagsChanged:function (a, b) {
$('#demo4Out').html(a + ' was ' + b);
} });
$('#demo5').tagit({maxLength:5, maxTags:5 });
$('#demo6').tagit({tagSource:availableTags, sortable:true});
$('#demo7').tagit({tagSource:availableTags, sortable:'handle'});
$('#demo9').tagit({tagSource:availableTags, editable: true});
$('#demo1GetTags').click(function () {
showTags($('#demo1').tagit('tags'))
});
$('#demo2GetTags').click(function () {
showTags($('#demo2').tagit('tags'))
});
$('#demo2ResetTags').click(function () {
$('#demo2').tagit('reset')
});
$('#demo3GetTags').click(function () {
showTags($('#demo3').tagit('tags'))
});
$('#demo4GetTags').click(function () {
showTags($('#demo4').tagit('tags'))
});
$('#demo5GetTags').click(function () {
showTags($('#demo5').tagit('tags'))
});
$('#demo6GetTags').click(function () {
showTags($('#demo6').tagit('tags'))
});
$('#demo7GetTags').click(function () {
showTags($('#demo7').tagit('tags'))
});
$('#demo8GetTags').click(function () {
showTags($('#demo8').tagit('tags'))
});
$('#demo9GetTags').click(function () {
showTags($('#demo9').tagit('tags'))
});
function showTags(tags) {
console.log(tags);
var string = "Tags (label : value)\r\n";
string += "--------\r\n";
for (var i in tags)
string += tags[i].label + " : " + tags[i].value + "\r\n";
alert(string);
}
setInterval("$('#fork').effect('pulsate', { times:1 }, 500);", 5000);
});
</script>
</head>
<body>
<a id="fork" href="https://github.com/hailwood/jQuery-Tagit">
<img style="position: fixed; top: 0; left: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_left_red_aa0000.png" alt="Fork me on GitHub">
</a>
<div id="wrap">
<div id="switcher_parent">
<div id="switcher" class="notr">
<a href="index.themeroller.html">
Tried Tagit with ThemeRoller?<br/>
<img class="tr"
src="http://www.filamentgroup.com/examples/RollAUI/images/themeroller_ready_white_400px.gif"/>
</a>
</div>
</div>
<h1>jQuery Tagit Demo Page</h1>
<div class="box"><a href="docs.html">View the documentation!</a></div>
<h2><a name="demos">Demos</a></h2>
<h3>Hidden Select</h3>
<div class="box">
<div class="note">
Normally the select is hidden, however we have shown it for this demo so you can see
how it operates!
</div>
<ul id="demo1" data-name="nameOfSelect"></ul>
<div class="buttons">
<button id="demo1GetTags" value="Get Tags">Get Tags</button>
</div>
</div>
<h3>Initial Tags</h3>
<div class="box">
<div class="note">
You can manually specify tags in your markup by adding <em>list items</em> to the unordered list!
</div>
<ul id="demo2" data-name="demo2">
<li data-value="here">here</li>
<li data-value="are">are</li>
<li data-value="some...">some</li>
<!-- notice that this tag is setting a different value :) -->
<li data-value="initial">initial</li>
<li data-value="tags">tags</li>
</ul>
<div class="buttons">
<button id="demo2GetTags" value="Get Tags">Get Tags</button>
<button id="demo2ResetTags" value="Reset Tags">Reset Tags</button>
</div>
</div>
<h3>Allowing Spaces</h3>
<div class="box">
<div class="note">
By overriding the <em>trigger keys</em> you can have spaces, comma's and any other character in your tags!
</div>
<ul id="demo3"></ul>
<div class="buttons">
<button id="demo3GetTags" value="Get Tags">Get Tags</button>
</div>
</div>
<h3>Callback</h3>
<div class="box">
<div class="note">
By passing a function in for <em>tagsChanged</em> you can preform your own events too!
</div>
<ul id="demo4"></ul>
<div class="buttons">
<button id="demo4GetTags" value="Get Tags">Get Tags</button>
</div>
<p>Action:
<div id="demo4Out">none</div>
<p>
</div>
<h3>Limits</h3>
<div class="box">
<div class="note">
You can limit both the maximum and minimum amount of, and characters per tag!
</div>
<ul id="demo5"></ul>
<div class="buttons">
<button id="demo5GetTags" value="Get Tags">Get Tags</button>
</div>
<p>Maximum of 5 tags and 5 characters per tag.</p>
</div>
<h3>Sortable : true</h3>
<div class="box">
<div class="note">
You can allow the tags to be sortable by dragging the entire tag!
</div>
<ul id="demo6" name="demo6">
<li>here</li>
<li>are</li>
<li>some</li>
<li>initial</li>
<li>tags</li>
</ul>
<div class="buttons">
<button id="demo6GetTags" value="Get Tags">Get Tags</button>
</div>
</div>
<h3>Sortable : handle</h3>
<div class="box">
<div class="note">
Or only draggable by a handle!
</div>
<ul id="demo7" name="demo7">
<li>here</li>
<li>are</li>
<li>some</li>
<li>initial</li>
<li>tags</li>
</ul>
<div class="buttons">
<button id="demo7GetTags" value="Get Tags">Get Tags</button>
</div>
</div>
<h3>Editable</h3>
<div class="box">
<div class="note">
Click on a tag to edit it!
</div>
<ul id="demo9" name="demo9">
<li>here</li>
<li>are</li>
<li>some</li>
<li>initial</li>
<li>tags</li>
</ul>
<div class="buttons">
<button id="demo9GetTags" value="Get Tags">Get Tags</button>
</div>
</div>
<h3>Custom Autocomplete</h3>
<div class="box">
<div class="note">
You can hack into the autocomplete dropdown to display custom data!
</div>
<div class="note">
While this demo could be done using either the <a href="index.themeroller.html">themeroller</a> or normal version
for simplicities sake we have only created this particular demo using <a
href="index.themeroller.html">themeroller</a>.
<hr/>
Please <a href="index.themeroller.html#demo8">Click here to view this demo</a>!
</div>
</div>
<h2></h2>
<div class="box">
© Content and Design Matthew Hailwood 2012<br/>
</div>
</div>
</body>
</html>