-
Notifications
You must be signed in to change notification settings - Fork 1
/
readme.html
554 lines (480 loc) · 23.9 KB
/
readme.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
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
<!doctype html>
<html class="no-js" lang="en-US">
<head>
<meta charset="utf-8">
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<![endif]-->
<title>Lightweight, Simple, jQuery + CSS Dropdown Menu Plugin</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="dropdown-menu.css" />
<link rel="stylesheet" href="dropdown-menu-skin.css" />
<script type="text/javascript" src="lib/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="dropdown-menu.min.js"></script>
<style type="text/css">
/* Styles specific to this page */
body {font-family:"Lucida Sans Unicode","Lucida Grande",Verdana,Helvetica,sans-serif;font-size:14px;}
a, a:visited {color:#e00;}
a:hover {color:#f00;}
code {color:#2821FF;font-family:"Lucida Console",monospace;}
.example {margin-bottom:35px;}
ul {margin-left:35px;padding:0;}
#download ul {list-style: none;margin:0;padding:0;}
#download ul ul {list-style: disc;margin-left:35px;}
img, input {vertical-align:text-bottom;}
/* Menu styles */
#example4 .dropdown-menu {
width: 250px;
}
</style>
<script type="text/javascript">
$(function() {
$('#example1 .dropdown-menu').dropdown_menu({
sub_indicators : true,
drop_shadows : true,
close_delay : 500
});
$('#example2 .dropdown-menu').dropdown_menu({
sub_indicator_class : 'dropdown-menu-sub-indicator', // Class given to LI's with submenus
vertical_class : 'dropdown-menu-vertical', // Class for a vertical menu
shadow_class : 'dropdown-menu-shadow', // Class for drop shadow on submenus
hover_class : 'dropdown-menu-hover', // Class applied to hovered LI's
open_delay : 150, // Delay on menu open
close_delay : 300, // Delay on menu close
animation_open : { opacity : 'show' }, // Animation for menu open
speed_open : 'fast', // Animation speed for menu open
animation_close : { opacity : 'hide' }, // Animation for menu close
speed_close : 'fast', // Animation speed for menu close
sub_indicators : false, // Whether to show arrows for submenus
drop_shadows : false, // Whether to apply drop shadow class to submenus
vertical : false, // Whether the root menu is vertically aligned
viewport_overflow : 'auto', // Handle submenu opening offscreen: "auto", "move", "scroll", or false
init : function() {} // Callback function applied on init
});
$('#example3 .dropdown-menu').dropdown_menu();
$('#example4 .dropdown-menu').dropdown_menu({
sub_indicators : true,
drop_shadows : true,
vertical : true
});
});
</script>
</head>
<body>
<h1>Lightweight, Simple, Styleable jQuery + CSS Dropdown Menu Plugin</h1>
<ul>
<li><a href="#download">Download</a></li>
<li><a href="#license">License</a></li>
<li><a href="#features">Features</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#examples">Demonstrations</a></li>
<li><a href="#credits">Acknowledgements</a></li>
</ul>
<div id="download">
<h2>Download</h2>
<p><big>Full Archive: <a href="https://github.com/groovenectar/jquery-css-dropdown-plugin/archive/master.zip">dropdown-menu.zip</a></big></p>
<p><a href="https://github.com/groovenectar/jquery-css-dropdown-plugin">GitHub Project Homepage</a></p>
<ul>
<li>
Containing files:
<ul>
<li>arrows-000000.png <a href="https://raw.github.com/groovenectar/jquery-css-dropdown-plugin/master/arrows-000000.png">(view)</a></li>
<li>arrows-ffffff.png <a href="https://raw.github.com/groovenectar/jquery-css-dropdown-plugin/master/arrows-ffffff.png">(view)</a></li>
<li>dropdown-menu-skin.css <a href="https://raw.github.com/groovenectar/jquery-css-dropdown-plugin/master/dropdown-menu-skin.css">(raw)</a> <a href="https://github.com/groovenectar/jquery-css-dropdown-plugin/blob/master/dropdown-menu-skin.css">(highlighted)</a></li>
<li>dropdown-menu.css <a href="https://raw.github.com/groovenectar/jquery-css-dropdown-plugin/master/dropdown-menu.css">(raw)</a> <a href="https://github.com/groovenectar/jquery-css-dropdown-plugin/blob/master/dropdown-menu.css">(highlighted)</a></li>
<li>dropdown-menu.js <a href="https://raw.github.com/groovenectar/jquery-css-dropdown-plugin/master/dropdown-menu.js">(raw)</a> <a href="https://github.com/groovenectar/jquery-css-dropdown-plugin/blob/master/dropdown-menu.js">(highlighted)</a></li>
<li>dropdown-menu.min.js <a href="https://raw.github.com/groovenectar/jquery-css-dropdown-plugin/master/dropdown-menu.min.js">(raw)</a> <a href="https://github.com/groovenectar/jquery-css-dropdown-plugin/blob/master/dropdown-menu.min.js">(highlighted)</a></li>
</ul>
</li>
</ul>
</div>
<div id="license">
<h2>License</h2>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p>
If you find this dropdown script to be especially useful and would like to donate some funds, you are welcomed to do so via PayPal:
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="YTW3QJNVJEQF2" />
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" style="border:none;" name="submit" alt="PayPal - The safer, easier way to pay online!" />
<img alt="" style="border:none;" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</p>
</form>
<p>You are free to use this script for commercial and non-commercial projects. I would love to <a href="mailto:[email protected]">hear from you</a> if you use it or have input.</p>
</div>
<div id="features">
<h2>Features</h2>
<ul>
<li>Clean, minimalist design, ready to be styled. Ease of use and styling are the goals. This should be a great starting point if you are looking to create a similar menu.</li>
<li>Handles submenu items appearing outside the viewport/window</li>
<li>For mobile/touch devices, ensures an item's submenu is showing before allowing its link to be opened</li>
<li>Option for either horizontal or vertical menu</li>
<li>Supports variable-width menu items. Vertical menus must have a width defined at the root, but submenus are still variable.</li>
<li>Independent timers on open/close of submenus to reduce accidental menu operations</li>
<li>Option to automatically add arrows indicating submenus</li>
<li>Option to automatically apply a CSS3 drop shadow class to submenus</li>
<li>Customizable submenu display animation using jQuery's <code>animate()</code> effects</li>
<li>Functioning in tests with Chrome, Firefox, Safari, IE >= 7, Android WebKit, and Android Firefox</li>
</ul>
</div>
<div id="usage">
<h2>Usage</h2>
<p>Include the jQuery library, <code>dropdown-menu.min.js</code> and <code>dropdown-menu.css</code> on the page:</p>
<pre><code><link rel="stylesheet" href="dropdown-menu.css" />
<script type="text/javascript" src="lib/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="dropdown-menu.min.js"></script></code></pre>
<p>Use a standard UL/LI menu with anchors:</p>
<pre><code><ul class="dropdown-menu">
<li><a href="#">Item 1</a></li>
<li>
<a href="#">Item 2</a>
<ul>
<li>
<a href="#">Submenu Item</a>
<ul>
<li><a href="#">Submenu Item 1</a></li>
<li><a href="#">Submenu Item 2</a></li>
</ul>
</li>
</ul>
</li>
</ul></code></pre>
<p>Apply the <code>dropdown_menu()</code> function in a Document Ready section:</p>
<pre><code><script type="text/javascript">
$(function() {
$('.dropdown-menu').dropdown_menu();
});
</script></code></pre>
<p>See <a href="#example1">Example 1</a> and <a href="dropdown-menu-skin.css">dropdown-menu-skin.css</a> for styling hints.</p>
<p>See <a href="#example2" onclick="$('#example2').find('pre:hidden').slideDown();">Example 2 source code</a> for complete configuration options.</p>
</div>
<h2 id="examples">Demonstrations</h2>
<div class="example" id="example1">
<h3>Example 1 - Custom CSS3 Skin and Increased Menu Close Delay</h3>
<p><a href="#" onclick="$(this).parent('p').next('pre').slideToggle();return false;">Toggle Source</a></p>
<pre style="display:none;"><code><link rel="stylesheet" href="dropdown-menu.css" />
<link rel="stylesheet" href="dropdown-menu-skin.css" />
<script type="text/javascript" src="lib/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="dropdown-menu.min.js"></script>
<script type="text/javascript">
$(function() {
$('#example1').dropdown_menu({
sub_indicators : true,
drop_shadows : true,
close_delay : 500
});});
</script>
<ul id="example1" class="dropdown-menu dropdown-menu-skin">
<li><a href="#">Item 1</a></li>
<li>
<a href="#">Item 2</a>
<ul>
<li>
<a href="#">Submenu Item</a>
<ul>
<li><a href="#">Submenu Item 1</a></li>
<li><a href="#">Submenu Item 2</a></li>
</ul>
</li>
</ul>
</li>
</ul></code></pre>
<ul class="dropdown-menu dropdown-menu-skin">
<li><a href="#">Lorem Ipsom Dolor</a></li>
<li>
<a href="#">Menu Item With Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li>
<a href="#">Submenu Item with Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li>
<a href="#">Submenu Item with Submenu</a>
<ul>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Voluptate Velit Esse</a></li>
<li>
<a href="#">Another Item with Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li>
<a href="#">Submenu Item With Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Officia Deserunt Mollit</a></li>
<li><a href="#">Eu Fugiat Nulla</a></li>
</ul>
</li>
<li><a href="#">Occaecat Cupidatat</a></li>
</ul>
</div>
<div class="example" id="example2">
<h3>Example 2 - All Options Specified (Default Values)</h3>
<p><a href="#" onclick="$(this).parent('p').next('pre').slideToggle();return false;">Toggle Source</a></p>
<pre style="display:none;"><code><link rel="stylesheet" href="dropdown-menu.css" />
<script type="text/javascript" src="lib/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="dropdown-menu.min.js"></script>
<script type="text/javascript">
$(function() {
$('#example2').dropdown_menu({
sub_indicator_class : 'dropdown-menu-sub-indicator', // Class given to LI's with submenus
vertical_class : 'dropdown-menu-vertical', // Class for a vertical menu
shadow_class : 'dropdown-menu-shadow', // Class for drop shadow on submenus
hover_class : 'dropdown-menu-hover', // Class applied to hovered LI's
open_delay : 150, // Delay on menu open
close_delay : 300, // Delay on menu close
animation_open : { opacity : 'show' }, // Animation for menu open
speed_open : 'fast', // Animation speed for menu open
animation_close : { opacity : 'hide' }, // Animation for menu close
speed_close : 'fast', // Animation speed for menu close
sub_indicators : false, // Whether to show arrows for submenus
drop_shadows : false, // Whether to apply drop shadow class to submenus
vertical : false, // Whether the root menu is vertically aligned
viewport_overflow : 'auto', // Handle submenu opening offscreen: "auto", "move", "scroll", or false
init : function() {} // Callback function applied on init
});
</script>
<ul id="example2" class="dropdown-menu">
<li><a href="#">Item 1</a></li>
<li>
<a href="#">Item 2</a>
<ul>
<li>
<a href="#">Submenu Item</a>
<ul>
<li><a href="#">Submenu Item 1</a></li>
<li><a href="#">Submenu Item 2</a></li>
</ul>
</li>
</ul>
</li>
</ul></code></pre>
<ul class="dropdown-menu">
<li><a href="#">Lorem Ipsom Dolor</a></li>
<li>
<a href="#">Menu Item With Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li>
<a href="#">Submenu Item with Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li>
<a href="#">Submenu Item with Submenu</a>
<ul>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Voluptate Velit Esse</a></li>
<li>
<a href="#">Another Item with Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li>
<a href="#">Submenu Item With Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Officia Deserunt Mollit</a></li>
<li><a href="#">Eu Fugiat Nulla</a></li>
</ul>
</li>
<li><a href="#">Occaecat Cupidatat</a></li>
</ul>
</div>
<div class="example" id="example3">
<h3>Example 3 - Specify Options With HTML5 Data Attribute</h3>
<p>You can use JSON data in a <code>data-options</code> attribute of the <code>UL</code>. Requires a specific single/double quote precedence.</p>
<p><a href="#" onclick="$(this).parent('p').next('pre').slideToggle();return false;">Toggle Source</a></p>
<pre style="display:none;"><code><link rel="stylesheet" href="dropdown-menu.css" />
<script type="text/javascript" src="lib/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="dropdown-menu.min.js"></script>
<script type="text/javascript">
$(function() {
$('#example3').dropdown_menu();
});
</script>
<ul id="example3" class="dropdown-menu" data-options='{"sub_indicators":"true","drop_shadows":"true"}'>
<li><a href="#">Item 1</a></li>
<li>
<a href="#">Item 2</a>
<ul>
<li>
<a href="#">Submenu Item</a>
<ul>
<li><a href="#">Submenu Item 1</a></li>
<li><a href="#">Submenu Item 2</a></li>
</ul>
</li>
</ul>
</li>
</ul></code></pre>
<ul class="dropdown-menu" data-options='{"sub_indicators":"true","drop_shadows":"true"}'>
<li><a href="#">Lorem Ipsom Dolor</a></li>
<li>
<a href="#">Menu Item With Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li>
<a href="#">Submenu Item with Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li>
<a href="#">Submenu Item with Submenu</a>
<ul>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Voluptate Velit Esse</a></li>
<li>
<a href="#">Another Item with Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li>
<a href="#">Submenu Item With Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Officia Deserunt Mollit</a></li>
<li><a href="#">Eu Fugiat Nulla</a></li>
</ul>
</li>
<li><a href="#">Occaecat Cupidatat</a></li>
</ul>
</div>
<div class="example" id="example4">
<h3>Example 4 - Vertical Style Menu With Shadows and Arrows</h3>
<p>For vertical menus, the root menu's width must be specified. Default in stylesheet is 250px.</p>
<p><a href="#" onclick="$(this).parent('p').next('pre').slideToggle();return false;">Toggle Source</a></p>
<pre style="display:none;"><code><link rel="stylesheet" href="dropdown-menu.css" />
<script type="text/javascript" src="lib/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="dropdown-menu.min.js"></script>
<script type="text/javascript">
$(function() {
$('#example4').dropdown_menu({
sub_indicators : true,
vertical : true
});
});
</script>
<style type="text/css">
#example4 {
width: 250px;
}
</style>
<ul id="example4" class="dropdown-menu">
<li><a href="#">Item 1</a></li>
<li>
<a href="#">Item 2</a>
<ul>
<li>
<a href="#">Submenu Item</a>
<ul>
<li><a href="#">Submenu Item 1</a></li>
<li><a href="#">Submenu Item 2</a></li>
</ul>
</li>
</ul>
</li>
</ul></code></pre>
<ul class="dropdown-menu">
<li><a href="#">Lorem Ipsom Dolor</a></li>
<li>
<a href="#">Menu Item With Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li>
<a href="#">Submenu Item with Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li>
<a href="#">Submenu Item with Submenu</a>
<ul>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Voluptate Velit Esse</a></li>
<li>
<a href="#">Another Item with Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li>
<a href="#">Submenu Item With Submenu</a>
<ul>
<li><a href="#">Excepteur Sint Occaecat</a></li>
<li><a href="#">Dolore Eu Fugiat</a></li>
<li><a href="#">Sunt In Culpa Qui</a></li>
<li><a href="#">Cillum Dolore</a></li>
</ul>
</li>
<li><a href="#">Officia Deserunt Mollit</a></li>
<li><a href="#">Eu Fugiat Nulla</a></li>
</ul>
</li>
<li><a href="#">Occaecat Cupidatat</a></li>
</ul>
</div>
<div id="credits">
<h2>Acknowledgements</h2>
<p>
By Daniel Upshaw. This script was inspired by the classic jQuery menu plugin <a href="http://users.tpg.com.au/j_birch/plugins/superfish/">Superfish</a>,
which was inspired by <a href="http://alistapart.com/">ALA</a>'s <a href="http://alistapart.com/articles/dropdowns">Suckerfish</a>.
</p>
</div>
</body>
</html>