-
Notifications
You must be signed in to change notification settings - Fork 664
/
Copy pathindex.html
562 lines (454 loc) · 19.7 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
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
555
556
557
558
559
560
561
562
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.2/jquery.modal.min.css" />
<script src="highlight/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8"> hljs.initHighlightingOnLoad(); </script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
<link rel="stylesheet" href="highlight/github.css" type="text/css" media="screen" />
<link href="https://fonts.googleapis.com/css?family=Lato:400,400i,900,900i&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fira+Mono:400" rel="stylesheet">
<style type="text/css" media="screen">
html {
font-size: 18px;
}
body {
font-weight: 400;
font-family: "Lato", "Helvetica Neue", arial, sans-serif;
line-height: 1.666;
-webkit-font-smoothing: antialiased;
color: #5e6c76;
margin: 0;
padding: 10px 0 0 0;
}
.band {
background-image: linear-gradient(to right, #2a27a8 0%,#8c50bc 50%,#fc6e6c 100%);
height: 10px;
top: 0;
right: 0;
left: 0;
position: fixed;
}
.wrapper {
padding: 2em 20px;
max-width: 900px;
margin: 0 auto;
}
small { color: #aaa; }
h1,h2,h3,h4 { color: #404a50; font-weight: 800; font-size: 1.75em; line-height: 1.1; margin: 0 0 1.5rem 0; }
h2 a { color: #cad1d5; border: none; }
h2 a:hover { color: #fa0065; }
a { color: #fa0065; font-weight: 700; transition-duration: .2s; text-decoration: none; border-bottom: 2px solid transparent; }
a:hover { color: #22272a; border-color: #22272a; }
p, ul, ol, pre { margin: 0 auto 1.5rem auto; }
p code, li code {color: #000080; font-size: .9em; }
pre { font-size: 14px; line-height: 2; }
pre code { overflow: scroll; padding: 1em; border-radius: 4px; background: #f9fafb; color: #475359; }
hr { height: 3px; background: #f0f2f3; border: none; margin: 3rem 0; border-radius: 3px; }
table {width:100%;border-collapse:collapse;}
td { border: 1px solid #eee; padding: 15px; }
td pre { margin: 0; }
code { font-family: 'fira mono', monospace; }
a.btn {
color: #fff;
background: #FF0066;
padding: .5rem 1rem;
display: inline-block;
border-radius: 4px;
transition-duration: .25s;
border: none;
font-size: 14px;
}
a.btn:hover {
background: #22272a;
}
.header h1 {
margin: 1rem 0 .5rem 0;
}
.header iframe {
margin-bottom: 2rem;
}
.header p {
margin: 0 0 .5rem 0;
font-size: 1.25rem;
}
.header ul {
list-style-type: none;
margin-right: 0;
padding: 0;
line-height: 2;
}
.header ul li:before {
content: '\2714';
margin-right: .5em;
color: #94be47;
font-size: .75em;
}
/* Example 2 (login form) */
.login_form.modal {
border-radius: 0;
line-height: 18px;
padding: 0;
font-family: "Lucida Grande", Verdana, sans-serif;
}
.login_form h3 {
margin: 0;
padding: 10px;
color: #fff;
font-size: 14px;
background: -moz-linear-gradient(top, #2e5764, #1e3d47);
background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #1e3d47),color-stop(1, #2e5764));
}
.login_form.modal p { padding: 20px 30px; border-bottom: 1px solid #ddd; margin: 0;
background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #eee),color-stop(1, #fff));
overflow: hidden;
}
.login_form.modal p:last-child { border: none; }
.login_form.modal p label { float: left; font-weight: bold; color: #333; font-size: 13px; width: 110px; line-height: 22px; }
.login_form.modal p input[type="text"],
.login_form.modal p input[type="password"] {
font: normal 12px/18px "Lucida Grande", Verdana;
padding: 3px;
border: 1px solid #ddd;
width: 200px;
}
.part {
display: none;
}
.modal p { margin: 1em 0; }
.modal a.close-modal { border: none; }
@media(max-width: 600px) {
html {
font-size: 14px;
}
h2 a { display: block; margin-bottom: 0.5em; }
pre { font-size: 11px; line-height: 1.5; }
pre code { padding: 5px; }
a.btn { display: block; text-align: center; padding: 1rem; }
}
</style>
<title>jQuery Modal</title>
<meta name="description" content="jQuery Modal is the easiest way to display modal windows with jQuery. Built by Kyle Fox.">
<link rel="apple-touch-icon" sizes="57x57" href="https://kylefox.ca/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://kylefox.ca/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://kylefox.ca/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://kylefox.ca/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://kylefox.ca/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://kylefox.ca/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://kylefox.ca/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://kylefox.ca/apple-touch-icon-152x152.png">
<link rel="icon" type="image/png" href="https://kylefox.ca/favicon-196x196.png" sizes="196x196">
<link rel="icon" type="image/png" href="https://kylefox.ca/favicon-160x160.png" sizes="160x160">
<link rel="icon" type="image/png" href="https://kylefox.ca/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://kylefox.ca/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="https://kylefox.ca/favicon-32x32.png" sizes="32x32">
<meta name="msapplication-TileColor" content="#f0f0f0">
<meta name="msapplication-TileImage" content="https://kylefox.ca/mstile-144x144.png">
</head>
<body>
<div class="band"></div>
<div class="wrapper">
<div class="header">
<h1>jQuery Modal</h1>
<p class="sub">The simplest modal you ever did see.</p>
<a class="github-button" href="https://github.com/kylefox/jquery-modal" data-size="large" data-show-count="true" aria-label="Star kylefox/jquery-modal on GitHub">Star</a>
<ul>
<li>Automatic binding using HTML semantics</li>
<li>No images & light-weight <small>(about 1k minified)</small></li>
<li>Simple markup makes it easy to style</li>
<li>Attach custom behaviour using <a href="http://api.jquery.com/category/events/">jQuery events</a></li>
<li>Close with click or ESC key</li>
<li>Built by <a href="https://twitter.com/kylefox" target="_blank">@kylefox</a> 🍸</li>
</ul>
</div>
<hr>
<h2 id="install"><a href="#install">#</a> Install</h2>
<p>The simplest method is to use the hosted version from <a href="https://cdnjs.com/libraries/jquery-modal">cdnjs</a>:</p>
<pre><code><!-- Remember to include jQuery :) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<!-- jQuery Modal -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.css" /></code></pre>
<p>Refer to the <a href="https://github.com/kylefox/jquery-modal#installation">README</a> for more installation options.</p>
<hr />
<h2 id="example-1"><a href="#example-1">#</a> Example 1: Open & Close with links</h2>
<ol>
<li>Embed modal HTML in document</li>
<li>Create a link with <code>rel="modal:open"</code> and set the <code>href</code> attribute to the modal's DOM id.</li>
</ol>
<pre><code><!-- Modal HTML embedded directly into document -->
<div id="ex1" class="modal">
<p>Thanks for clicking. That felt good.</p>
<a href="#" rel="modal:close">Close</a>
</div>
<!-- Link to open the modal -->
<p><a href="#ex1" rel="modal:open">Open Modal</a></p></code></pre>
<a class="btn" href="#ex1" rel="modal:open">Open Modal</a>
<div class="modal" id="ex1">
<p>Thanks for clicking. That felt good. <br />Click <a href="#" rel="modal:close">close</a>, click the overlay, or press ESC</p>
</div>
<hr />
<h2 id="example-2"><a href="#example-2">#</a> Example 2: styled login form & events</h2>
<p>This example demonstrates how visually customizable the modal is.</p>
<a class="btn" href="#ex2" rel="modal:open">Open Modal</a>
<!-- Modal HTML embedded directly into document -->
<form action="" class="login_form modal" id="ex2" style="display:none;">
<h3>Please login to continue</h3>
<p><label>Username:</label><input type="text" /></p>
<p><label>Password:</label><input type="password" /></p>
<p><input type="submit" value="Login" /></p>
</form>
<hr />
<h2 id="example-3"><a href="#example-3">#</a> Example 3: adjusting to content</h2>
<p>This example shows how modals are centered automatically. It also demonstrates how a vertical scrollbar appears whenever the modal content overflows.</p>
<div id="ex3" class="modal">
<p><a id="more" href="#more">More!</a></p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<a class="btn" href="#ex3" rel="modal:open">Open Modal</a>
<hr />
<h2 id="example-4"><a href="#example-4">#</a> Example 4: AJAX</h2>
<p>Use <code>rel="modal:open"</code> to automatically load the page contents into a modal via AJAX:</p>
<pre><code><a href="ajax.html" rel="modal:open">example</a></code></pre>
<p><a class="btn" href="ajax.html" rel="modal:open">Open Modal</a></p>
<p>You can also manually load AJAX pages into a modal. Note that the AJAX response must be wrapped in a div with class <code>modal</code>:</p>
<pre><code><!-- Normal link --><br/><a href="ajax.html" id="manual-ajax">second example</a></code></pre>
<pre><code>// Open modal in AJAX callback
$('#manual-ajax').click(function(event) {
event.preventDefault();
this.blur(); // Manually remove focus from clicked link.
$.get(this.href, function(html) {
$(html).appendTo('body').modal();
});
});</code></pre>
<pre><code><!-- AJAX response must be wrapped in the modal's root class. --><br/><div class="modal"><br/> <p>Second AJAX Example!</p><br/></div></pre></code>
<a class="btn" href="ajax2.html" id="manual-ajax">Open Modal</a>
<hr />
<h2 id="example-5"><a href="#example-5">#</a> Example 5: the un-closable window</h2>
<p>This demonstrates how to disable the default methods of closing the modal.</p>
<pre><code> $("#sticky").modal({
escapeClose: false,
clickClose: false,
showClose: false
});</code></pre>
<a class="btn" href="#ex5">Open Modal</a>
<div id="ex5" class="modal">
<p>If you do this, be sure to provide the user with an alternate method of <a href="#" rel="modal:close">closing the window.</a></p>
</div>
<hr />
<h2 id="example-6"><a href="#example-6">#</a> Example 6: Multiple Modals</h2>
<p>By default, only one modal can be open at a time. If you open a new modal while an existing modal is open, the existing modal is closed first.</p>
<p><a class="btn" href="#ex6-1" rel="modal:open">Open Modals</a>
</p>
However, if you need to stack multiple modals at the same time, just set the <code>closeExisting</code> option to <code>false</code>.
</p>
<pre><code>
$('#sub-modal').modal({
closeExisting: false
});
</pre></code>
<a class="btn" href="#ex6-1b" rel="modal:open">Open Modals</a>
<div class="modal" id="ex6-1" style="display:none;">
<p>I'm the first modal. <a href="#ex6-2" rel="modal:open">Open second modal...</a></p>
</div>
<div class="modal" id="ex6-2" style="display:none;">
<p>I'm the second modal. <a href="#ex6-3" rel="modal:open">Open third modal...</a></p>
</div>
<div class="modal" id="ex6-3" style="display:none;">
<p>I'm the third modal. You get the idea.</p>
</div>
<div class="modal" id="ex6-1b" style="display:none;">
<p>I'm the first modal. <a href="#ex6-2b">Open second modal...</a></p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="modal" id="ex6-2b" style="display:none;">
<p>I'm the second modal. <a href="#ex6-3b">Open third modal...</a></p>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="modal" id="ex6-3b" style="display:none;">
<p>I'm the third modal. You get the idea.</p>
</div>
<hr />
<h2 id="example-7"><a href="#example-7">#</a> Example 7: Fade Transitions</h2>
<p>You can achieve a simple fade effect by specifying the <code>fadeDuration</code> option.</p>
<pre><code> $("#fade").modal({
fadeDuration: 100
});</code></pre>
<p><a class="btn" href="#ex7">Open Modal</a></p>
<p>You can also use <code>fadeDelay</code> to control the point during the overlay's fade in at which the modal fades in. For example, to fade in the modal when the overlay transition is 50% complete:</p>
<pre><code> $("#fade").modal({
fadeDuration: 1000,
fadeDelay: 0.50
});</code></pre>
<p><a class="btn" href="#ex8">Open Modal</a></p>
<p>
The default value is <code>1.0</code>, meaning the window transition begins once the overlay transition has finished.
Values greater than <code>1.0</code> mean there is a delay between the completed overlay transition and the start of the window transition:</p>
<pre><code> $("#fade").modal({
fadeDuration: 1000,
fadeDelay: 1.75 // Will fade in 750ms after the overlay finishes.
});</code></pre>
<p><a class="btn" href="#ex9">Open Modal</a></p>
<p><small>Tip: set <code>fadeDelay: 0</code> to have the overlay and window fade in simultaneously.</small></p>
<p>In the spirit of keeping this library small, fading is the only supported transition. When the modal is closed, both the overal and window transition out simultaneously.</p>
<div id="ex7" class="modal">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div id="ex8" class="modal">
<p>This modal starts fading in once the overlay is 50% faded in.</p>
</div>
<div id="ex9" class="modal">
<p>This modal starts fading in well after the overlay has finished transitioning.</p>
</div>
<hr/>
<h2 id="example-8"><a href="#example-8">#</a> Example 8: Custom Class for Close Button</h2>
<p>
This example demonstrates how to add extra classes to the close button (for custom styles for the close button):
</p>
<pre><code> $("#custom-close").modal({
closeClass: 'icon-remove',
closeText: '!'
});</code></pre>
<p>And then of course your custom CSS</p>
<pre><code>.modal a.close-modal[class*="icon-"] {
top: -10px;
right: -10px;
width: 20px;
height: 20px;
color: #fff;
line-height: 1.25;
text-align: center;
text-decoration: none;
text-indent: 0;
background: #900;
border: 2px solid #fff;
-webkit-border-radius: 26px;
-moz-border-radius: 26px;
-o-border-radius: 26px;
-ms-border-radius: 26px;
-moz-box-shadow: 1px 1px 5px rgba(0,0,0,0.5);
-webkit-box-shadow: 1px 1px 5px rgba(0,0,0,0.5);
box-shadow: 1px 1px 5px rgba(0,0,0,0.5);
}</code></pre>
<a class="btn" href="#ex10">Open Modal</a>
<div id="ex10" class="modal">
<p>This modal has a fancy-shmancy close button.</p>
</div>
<style type="text/css">
.modal a.close-modal[class*="icon-"] {
top: -10px;
right: -10px;
width: 20px;
height: 20px;
color: #fff;
line-height: 1.25;
text-align: center;
text-decoration: none;
text-indent: 0;
background: #900;
border: 2px solid #fff;
-webkit-border-radius: 26px;
-moz-border-radius: 26px;
-o-border-radius: 26px;
-ms-border-radius: 26px;
-moz-box-shadow: 1px 1px 5px rgba(0,0,0,0.5);
-webkit-box-shadow: 1px 1px 5px rgba(0,0,0,0.5);
box-shadow: 1px 1px 5px rgba(0,0,0,0.5);
}
</style>
<script type="text/javascript" charset="utf-8">
$(function() {
function log_modal_event(event, modal) {
if(typeof console != 'undefined' && console.log) console.log("[event] " + event.type);
};
$(document).on($.modal.BEFORE_BLOCK, log_modal_event);
$(document).on($.modal.BLOCK, log_modal_event);
$(document).on($.modal.BEFORE_OPEN, log_modal_event);
$(document).on($.modal.OPEN, log_modal_event);
$(document).on($.modal.BEFORE_CLOSE, log_modal_event);
$(document).on($.modal.CLOSE, log_modal_event);
$(document).on($.modal.AFTER_CLOSE, log_modal_event);
$(document).on($.modal.AJAX_SEND, log_modal_event);
$(document).on($.modal.AJAX_SUCCESS, log_modal_event);
$(document).on($.modal.AJAX_COMPLETE, log_modal_event);
$('#more').click(function() {
$(this).parent().after($(this).parent().next().clone());
return false;
});
$('#manual-ajax').click(function(event) {
event.preventDefault();
this.blur();
$.get(this.href, function(html) {
$(html).appendTo('body').modal();
});
});
$('a[href="#ex5"]').click(function(event) {
event.preventDefault();
$(this).modal({
escapeClose: false,
clickClose: false,
showClose: false
});
});
$('a[href="#ex6-2b"],a[href="#ex6-3b"]').click(function(event) {
event.preventDefault();
$(this).modal({
closeExisting: false
});
});
$('a[href="#ex7"]').click(function(event) {
event.preventDefault();
$(this).modal({
fadeDuration: 250
});
});
$('a[href="#ex8"]').click(function(event) {
event.preventDefault();
$(this).modal({
fadeDuration: 1000,
fadeDelay: 0.50
});
});
$('a[href="#ex9"]').click(function(event) {
event.preventDefault();
$(this).modal({
fadeDuration: 1000,
fadeDelay: 1.75
});
});
$('a[href="#ex10"]').click(function(event){
event.preventDefault();
$(this).modal({
closeClass: 'icon-remove',
closeText: '!'
});
});
});
</script>
<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-1701128-22', 'auto');
ga('send', 'pageview');
</script>
</div>
</body>
</html>