forked from zahirchanda/easydropdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
425 lines (365 loc) · 17.2 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
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=320, initial-scale=1, maximum-scale=1, user-scalable=1"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="keywords" content="easydropdown, jquery, drop-down, bootstrap, front-end, css3, jquery, patrick kunka, barrel, new york, manhattan, mixitup"/>
<meta name="description" content="A Drop-down Builder for Styleable Inputs and Menus"/>
<meta property="og:description" content="A Drop-down Builder for Styleable Inputs and Menus"/>
<meta property="og:type" content="website"/>
<meta property="og:site_name" content="EasyDropDown"/>
<meta property="og:title" content="EasyDropDown"/>
<meta property="og:image" content="http://kunkalabs.com/im/og_logo.png"/>
<meta property="og:url" content="http://patrickkunka.github.io/easydropdown"/>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->
<link rel="shortcut icon" type="image/x-icon" href="http://kunkalabs.com/im/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="demo.css"/>
<link rel="stylesheet" type="text/css" href="themes/easydropdown.css"/>
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="src/jquery.easydropdown.js"></script>
<title>EasyDropDown - A Drop-down Builder for Styleable Inputs and Menus</title>
</head>
<body>
<header>
<div class="wrapper just">
<hgroup>
<h1>jQuery EasyDropDown</h1>
<h2>A Drop-down Builder for <strong>Styleable</strong> Inputs and Menus</h2>
</hgroup>
<p class="legal">© Copyright 2013 <a href="http://twitter.com/PatrickKunka" target="_blank">Patrick Kunka</a> / <a href="http://kunkalabs.com" target="_blank">kunkalabs.com</a></p>
</div>
</header>
<section>
<div class="col col_1">
<div class="wrapper">
<h3>What Is It?</h3>
<p>EasyDropDown is a jQuery plugin that effortlessly turns humble <code><select></code> elements …</p>
<fieldset>
<select tabindex="1">
<option value="" class="label">Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<select tabindex="2">
<option value="" class="label">Day</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select tabindex="3">
<option value="" class="label">Year</option>
<option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
<option value="1991">1991</option>
<option value="1990">1990</option>
</select>
</fieldset>
<p>… into <strong>styleable drop-down menus</strong> for use in forms or general UI/navigation.</p>
<fieldset>
<select tabindex="4" class="dropdown">
<option value="" class="label" value="">Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="April">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<select tabindex="5" class="dropdown" data-settings='{"cutOff": 12}'>
<option value="" class="label">Day</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select tabindex="6" class="dropdown" data-settings='{"cutOff": 12}'>
<option value="" class="label">Year</option>
<option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
<option value="1991">1991</option>
<option value="1990">1990</option>
</select>
</fieldset>
<p>It's like <em><a href="http://harvesthq.github.io/chosen/" target="_blank">Chosen</a></em> but with only the essential features:</p>
<ul class="text">
<li>Clean, semantic markup</li>
<li>Form & validation compatibilty</li>
<li>Full keyboard control with textual search</li>
<li>Inner-scroll for long lists</li>
<li>Degradation to native UI on touch devices</li>
<li>Fully functional IE8+</li>
</ul>
<a href="https://github.com/patrickkunka/easydropdown" target="_blank" class="btn ib">Fork it on GitHub</a>
<p class="ib"><a href="https://github.com/patrickkunka/easydropdown/archive/master.zip">or download .ZIP</a></p>
<h3>Latest updates v2.1.4</h3>
<ul class="text">
<li>Menu height is now calculated in real time to allow for responsive typography, modals etc.</li>
<li>Various bug fixes</li>
</ul>
<h3>Available Ready-made Themes</h3>
<h4>Default / <a href="themes/easydropdown.css">easydropdown.css</a></h4>
<select class="dropdown" tabindex="7">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
</select>
<h4>Metro / <a href="themes/easydropdown.metro.css">easydropdown.metro.css</a></h4>
<select class="dropdown" tabindex="8" data-settings='{"wrapperClass":"metro"}'>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
</select>
<h4>Flat / <a href="themes/easydropdown.flat.css">easydropdown.flat.css</a></h4>
<select class="dropdown" tabindex="9" data-settings='{"wrapperClass":"flat"}'>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
</select>
</div>
</div>
<div class="col col_2">
<div class="wrapper">
<h3>How To Use It</h3>
<p>To use, simply include the <em>jquery.easydropdown.min.js</em> script in your page and give your <code><select></code> tags the class <code>dropdown</code>:</p>
<pre class="prettyprint lang-html"><select class="dropdown">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
</select></pre>
<p>If you are using labels within the <code><select></code> element, identify them with the class <code>label</code>:
<pre class="prettyprint lang-html"><select class="dropdown">
<option value="" class="label">Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
...
</select></pre>
<p>To build your dropdown with an arbitrary option pre-selected, simply give it the <code>selected</code> attribute as you normally would:</p>
<pre class="prettyprint lang-html"><select class="dropdown">
<option value="" class="label">Month</option>
<option value="1">January</option>
<option value="2" selected>February</option>
<option value="3">March</option>
...
</select></pre>
<p>Similarly, a dropdown may be disabled with the <code>disabled</code> attribute:</p>
<pre class="prettyprint lang-html"><select class="dropdown" disabled>
<option value="" class="label">Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
...
</select></pre>
<p>No custom JS required!</p>
<h3>How To Style It</h3>
<p>Either create your own styles to match your design and branding, or use one of our ready made themes. We recommend starting with the default theme and customizing it.</p>
<p>Each drop-down has the following basic markup structure that you can target with your CSS:</p>
<pre class="prettyprint lang-html"><div class="dropdown">
<span class="old">
<select>...</select>
</span>
<span class="selected">Option 1</span>
<span class="carat"></span>
<div>
<ul>
<li>Option 1</li>
<li>Option 2</li>
<li>Option 3</li>
<li>Option 4</li>
</ul>
</div>
</div></pre>
<p>The following classes are added/removed dynamically:</p>
<ul class="text">
<li><strong>.focus</strong> <em>(container)</em><br/>On input focus</li>
<li><strong>.open</strong> <em>(container)</em><br/>On menu open</li>
<li><strong>.scrollable</strong> <em>(container)</em><br/>When in scroll mode (see cutOff)</li>
<li><strong>.bottom</strong> <em>(container)</em><br/>On scroll bottom-out</li>
<li><strong>.touch</strong> <em>(container)</em><br/>When in native touch UI mode (see nativeTouch)</li>
<li><strong>.disabled</strong> <em>(container)</em><br/>When disabled</li>
<li><strong>.focus</strong> <em>(menu item)</em><br/>On hover or keyboard focus</li>
<li><strong>.active</strong> <em>(menu item)</em><br/>Selected menu item</li>
</ul>
<h3>Advanced Usage</h3>
<p>Alternatively, by not using the class 'dropdown' you can instantiate your dropdowns manually in your javascript, with custom settings.</p>
<pre class="prettyprint">$(function(){
var $selects = $('select');
$selects.easyDropDown({
cutOff: 10,
wrapperClass: 'my-dropdown-class',
onChange: function(selected){
// do something
}
});
});</pre>
<p>You may also define your customizable settings directly in your HTML via a JSON Object in the data-settings attribute:</p>
<pre class="prettyprint lang-html"><select class="dropdown"
data-settings='{"cutOff":6}'>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
..
</select></pre>
<p>The "onchange" attribute may be applied as normal:</p>
<pre class="prettyprint lang-html"><select class="dropdown" onchange="alert(this.value)">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
..
</select></pre>
<h3>Customizable Settings</h3>
<ul class="text">
<li><strong>cutOff</strong> <em>(integer)</em><br/>
The maximum number of items to show before scrolling (default <code>false</code>).</li>
<li><strong>wrapperClass</strong> <em>(string)</em><br/>
The class of the parent wrapper element, used to target styling (default <code>'dropdown'</code>).</li>
<li><strong>onChange</strong> <em>(function)</em><br/>
A custom function to call when an item is selected. Useful for non-form input uses. An object containing the selected item's value and title is passed as an argument.</li>
<li><strong>nativeTouch</strong> <em>(boolean)</em><br/>
Fallback to native UI on touch-enabled devices (default <code>true</code>).</li>
</ul>
<h3>Methods</h3>
<ul class="text">
<li><strong>.easyDropDown(</strong>'disable'<strong>)</strong><br/>
Disable the dropdown.</li>
<li><strong>.easyDropDown(</strong>'enable'<strong>)</strong><br/>
Enable the dropdown.</li>
<li><strong>.easyDropDown(</strong>'destroy'<strong>)</strong><br/>
Remove all generated elements and unbind all handlers.</li>
<li><strong>.easyDropDown(</strong>'select', <em>index/value</em><strong>)</strong><br/>
Programmatically select option by index (integer) or value (string).</li>
<li><strong>.val()</strong><br/>
Get selected value.</li>
</ul>
</div>
</section>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-39510854-3', 'patrickkunka.github.io');
ga('send', 'pageview');
</script>
</body>
</html>