-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·211 lines (206 loc) · 11.3 KB
/
index.html
File metadata and controls
executable file
·211 lines (206 loc) · 11.3 KB
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>jQuery FormLabels Plugin</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<script src="jquery.formLabels.js"></script>
<link type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/ui-darkness/jquery-ui.css" rel="stylesheet" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="http://o2v.net/files/demo/formLabels/plugins/styles/shCore.css" />
<link type="text/css" rel="stylesheet" href="http://o2v.net/files/demo/formLabels/plugins/styles/shThemeDefault.css" />
<script type="text/javascript" src="http://o2v.net/files/demo/formLabels/plugins/scripts/shCore.js"></script>
<script type="text/javascript" src="http://o2v.net/files/demo/formLabels/plugins/scripts/shBrushCss.js"></script>
<script type="text/javascript" src="http://o2v.net/files/demo/formLabels/plugins/scripts/shBrushJScript.js"></script>
<script src="init.js"></script>
</head>
<body>
<div class="container">
<h1>jQuery Form labels Plugin Demo <a href="http://o2v.net/blog/jquery-formlabels-plugin">Back to the tutorial</a></h1>
<div id="tabs">
<ul>
<li><a href="#default">Default functionality</a></li>
<li><a href="#excludeElts">Option: 'excludeElts'</a></li>
<li><a href="#refreshOnResize">Option: 'refreshOnResize'</a></li>
<li><a href="#safemode">Option: 'safemode'</a></li>
<li><a href="#labelParent">Option: 'labelParent'</a></li>
<li><a href="#semantic">Option: 'semantic'</a></li>
<li><a href="#refreshMethod">Method: 'refreshLabels()'</a></li>
</ul>
<div id="default" class="group">
<div class="example">
<div class="form-container">
<form method="post" action="" id="form1">
<h3>Login</h3>
<div class="field"><input type="email" name="email" title="Email Address" /></div>
<div class="field"><input type="password" name="password" title="Password" /></div>
<div class="submit"><button type="submit">Login</button></div>
</form>
</div>
</div>
<div class="tab-info">
<h3>Default Functionality</h3>
<div class="info">Run the plugin with default configuration options</div>
<h3>Code</h3>
<pre class="brush:javascript">
$("#form1").formLabels();
</pre>
<div class="results">Submit the form to see returned values</div>
</div>
</div>
<div id="excludeElts" class="group">
<div class="example">
<div class="form-container">
<form method="post" action="post" id="form2">
<h3>Login</h3>
<div class="field"><input type="email" name="email" title="Email Address" /></div>
<div class="field"><input type="password" name="password" title="Password" /></div>
<div class="field"><label style="font:bold 11px Arial">Secret word:</label><input type="password" name="secretWord" title="Secret Word" /></div>
<div class="submit"><button type="submit">Login</button></div>
</form>
</div>
</div>
<div class="tab-info">
<h3>Option: 'excludeElts'</h3>
<div class="info">Excludes certain elements from being 'labelized'</div>
<h3>Code</h3>
<pre class="brush:javascript">
$("#form2").formLabels({
excludeElts: 'input[name=secretWord]'
});
</pre>
<div class="results">Submit the form to see returned values</div>
</div>
</div>
<div id="refreshOnResize" class="group">
<div class="example">
<div class="form-container">
<form method="post" action="" id="form3">
<h3>Login</h3>
<div class="field"><input type="email" name="email" id="email" title="Email Address" /></div>
<div class="field"><input type="password" name="password" id="password" title="Password" /></div>
<div class="submit"><button type="submit">Login</button></div>
</form>
</div>
</div>
<div class="tab-info">
<h3>Option: 'refreshOnResize'</h3>
<div class="info">Whether or not refresh labels on window resize event. <br/>Resize browser window horizontally to see that labels are changing their position.</div>
<h3>Code</h3>
<pre class="brush:javascript">
$("#form3").formLabels({
labelParent : 'body',
refreshOnResize : true
});
</pre>
<div class="results">Submit the form to see returned values</div>
</div>
</div>
<div id="safemode" class="group">
<div class="example">
<div class="form-container">
<form method="post" action="post" id="form4">
<h3>Login</h3>
<div class="field"><input type="email" name="email" title="Email Address" /></div>
<div class="field"><input type="password" name="password" title="Password" /></div>
<div class="submit"><button type="submit">Login</button></div>
</form>
</div>
</div>
<div class="tab-info">
<h3>Option: 'safemode'</h3>
<div class="info">if enabled the plugin runs in safe mode without animation and other special features. Useful when dealing with unusual situations. Default: false</div>
<h3>Code</h3>
<pre class="brush:javascript">
$("#form4").formLabels({
safemode : true
});
</pre>
<div class="results">Submit the form to see returned values</div>
</div>
</div>
<div id="labelParent" class="group">
<div class="example">
<div class="form-container">
<form method="post" action="post" id="form5">
<h3>Login</h3>
<div class="field"><input type="email" name="email" title="Email Address" /></div>
<div class="field"><input type="password" name="password" title="Password" /></div>
<div class="submit"><button type="submit">Login</button></div>
</form>
<div id="labels"></div>
</div>
</div>
<div class="tab-info">
<h3>Option: 'labelParent'</h3>
<div class="info">Parent container for your 'labels'. Default: 'form' - labels will be inserted in closest form. Inspect source to find that labels was placed outside the form in the #labels div</div>
<h3>Code</h3>
<pre class="brush:javascript">
$("#form5").formLabels({
labelParent: '#labels'
});
</pre>
<div class="results">Submit the form to see returned values</div>
</div>
</div>
<div id="semantic" class="group">
<div class="example">
<div class="form-container">
<form method="post" action="post" id="form6">
<h3>Login</h3>
<div class="field"><input type="email" name="email" title="Email Address" /></div>
<div class="field"><input type="password" name="password" title="Password" /></div>
<div class="submit"><button type="submit">Login</button></div>
</form>
</div>
</div>
<div class="tab-info">
<h3>Option: 'semantic'</h3>
<div class="info">Although it's not recommended to turn off this function, in some cases it can be necessary. Setting it to <em>false</em> prevents inserting <label/> before input element and appends it at the end of a form</div>
<h3>Code</h3>
<pre class="brush:javascript">
$("#form6").formLabels({
semantic : false
});
</pre>
<div class="results">Submit the form to see returned values</div>
</div>
</div>
<div id="refreshMethod" class="group">
<div class="example">
<div class="form-container">
<form method="post" action="post" id="form7">
<h3>Login</h3>
<div class="field"><input type="email" name="email" title="Email Address" /></div>
<div class="field"><input type="password" name="password" title="Password" /></div>
<div class="submit"><button type="submit">Login</button></div>
</form>
<div class="group" id="resize-buttons">
<button id="refreshB">refresh</button>
<div style="font-size: 11px" class="position-info" id="status-message"></div>
</div>
</div>
</div>
<div class="tab-info">
<h3>Option: 'semantic'</h3>
<div class="info">Refresh labels' position. Useful when input position has been changed due to DOM manipulations, elements resizing, etc.<br/> Resize browser window horizontally, and then hit "refresh" to recalculate positions</div>
<h3>Code</h3>
<pre class="brush:javascript">
var formLabels = $("#form7").formLabels({
labelParent : 'body'
});
$("#refreshB").on("click", function () {
formLabels.refreshLabels();
});
</pre>
<div class="results">Submit the form to see returned values</div>
</div>
</div>
</div>
<div class="footer">
<p>Copyright © 2013 Andrei Zharau. All rights reserved.<br/>Boston, Massachusetts. Email: belmass[at]gmail.com</p>
</div>
</div>
</body>
</html>