-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathindex.html
213 lines (189 loc) · 6.63 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,user-scalable=no">
<title>floatingLabel.js | A small javascript floating label library</title>
<style>
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
}
body {
padding: 0;
margin: 0;
font: normal 16px/1.4 'Helvetica Neue', Helvetica, Arial, Sans-serif;
color: #3F5366;
}
a,
label {
color: #0476FA;
text-decoration: none;
}
label {
position: absolute;
top: 5px;
left: 7px;
z-index: -1;
font-size: 12px;
font-size: 0.75rem;
font-weight: bold;
opacity: 0;
transition: top 200ms, opacity 200ms;
}
label.floating {
top: -7px;
z-index: 1;
padding: 0 3px;
opacity: 1.0;
background-color: #FFF;
}
a:hover,
a:active {
text-decoration: underline;
}
form {
width: 100%;
margin: 0 auto;
}
form div {
position: relative;
}
form div + div {
margin-top: 20px;
}
input,
textarea {
display: block;
width: 100%;
padding: 10px;
font-family: 'Helvetica Neue', Helvetica, Arial, Sans-serif;
font-size: 18px;
font-size: 1.125rem;
background-color: white;
border: 1px solid #95ACC1;
border-radius: 3.5px;
transition: border 200ms;
}
input:focus,
textarea:focus {
border-color: #0074D9;
outline: none;
}
pre {
overflow: auto;
}
.content {
margin: 50px auto 0 auto;
padding-bottom: 20px;
width: 90%;
max-width: 600px;
}
.logo {
display: block;
width: 207px;
margin: 0 auto 30px auto;
}
.content > p:first-of-type {
font-size: 18px;
font-size: 1.125rem;
font-weight: 500;
margin-bottom: 20px;
}
.badges {
margin: 10px 0 30px 0;
text-align: center;
}
.h1 {
margin: 50px 0 0 0;
font-weight: 500;
}
dl {
margin: 20px 0 40px 0;
}
dt {
padding: 5px 10px;
font-size: 18px;
font-size: 1.125rem;
font-weight: bold;
border-left: 5px solid #0476FA;
}
dt pre {
margin: 0;
}
dd {
margin-left: 0;
}
dd p:first-child {
margin-top: 10px;
}
dd pre {
padding: 10px;
font-size: 14px;
font-size: 0.875rem;
border: 1px solid #95ACC1;
border-radius: 3.5px;
}
dd + dt {
margin-top: 40px;
}
</style>
</head>
<body>
<div class="content">
<img src="site/floatingLabel.png" class="logo" alt="floatingLabel.js logo">
<p>floatingLabel.js is a small javascript library to use the <a href="http://bradfrost.com/blog/post/float-label-pattern/">floating label pattern</a> on your own forms. It's light (1kb minified and gzipped) and <a href="#api">simple</a> to use.</p>
<div class="badges">
<iframe src="https://ghbtns.com/github-btn.html?user=datuhealth&repo=floating-label&type=star&count=true" frameborder="0" scrolling="0" width="120px" height="20px"></iframe>
<iframe src="https://ghbtns.com/github-btn.html?user=datuhealth&repo=floating-label&type=fork&count=true" frameborder="0" scrolling="0" width="120px" height="20px"></iframe>
</div>
<form method="POST" action="javascript:void(0);" enctype="application/x-www-form-urlencoded" role="form">
<div class="initial no-value">
<label for="no-value">No value</label>
<input type="text" name="no-value" id="no-value" placeholder="No value" />
</div>
<div class="initial value">
<label for="value">Initial value</label>
<input type="text" name="value" id="value" value="Initial value" />
</div>
<div class="initial no-value textarea">
<label for="no-value-textarea">No value on a textarea</label>
<textarea name="no-value-textarea" id="no-value-textarea" placeholder="No value"></textarea>
</div>
<div class="initial value textarea">
<label for="value-textarea">Initial value on a textarea</label>
<textarea name="value-textarea" id="value-textarea">Initial value</textarea>
</div>
<div class="initial no-label">
<input type="text" name="no-label" id="no-label" placeholder="This input doesn't have a label">
</div>
</form>
<h1 class="h1" id="api">api</h1>
<dl>
<dt><pre>init(options)</pre></dt>
<dd>
<p>The init method is a simple function to evaluate all the inputs on a page once the DOM has been loaded. An optional config object can be passed in to set a custom class and whether to delegate events or bind them directly on the inputs themselves.</p>
<pre>floatingLabel.init({
floatingClassName: 'custom-class', // defaults to 'floating'
delegateEvents: true // defaults to false
});</pre>
</dd>
<dt><pre>evaluateInputs()</pre></dt>
<dd>
<p>The meat an potatoes of floatingLabel is in the evaluateInputs method. This will read the DOM and loop through all input or textarea elements on the page. It will either bind events to each input or delegate the events to the body.</p>
<p>If you have a single page app and need to bind events to a newly rendered view, run eveluateInputs.</p>
<pre>floatingLabel.evaluateInputs();</pre>
</dd>
</dl>
<p>Floating Label is licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a> license.</p>
<p>Copyright 2015 Datu Health, Inc.</p>
</div>
<script src="node_modules/es5-shim/es5-shim.min.js"></script>
<script src="dist/floatingLabel.js"></script>
<script>floatingLabel.init();</script>
</body>
</html>