-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
535 lines (509 loc) · 11.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>confirmBoxDemo</title>
<link href="css/alertBox.css" rel = "stylesheet" type="text/css"/>
<style>
html,body{
width:100%;
height:100%;
background:#fff;
font-family:'sans-serif';
}
*{
margin:0;
padding:0;
box-sizing:border-box;
font-family:Helvetica, sans-serif;
}
.header{
width:100%;
height:200px;
background: #eee;
}
.header_content{
position: relative;
max-width: 640px;
margin:0 auto;
}
.header_content h1{
font-size: 30px;
font-weight:bold;
padding: 60px 20px 10px 0;
}
.header_content a{
position: absolute;
top:0;
right:0;
padding:10px;
background-color:#ccc;
color:#fff;
text-decoration: none;
font-weight: 500;
-webkit-transition:0.2s all ease;
-moz-transition:0.2s all ease;
-ms-transition:0.2s all ease;
-o-transition:0.2s all ease;
transition:0.2s all ease;
}
.header_content a:hover{
text-decoration: underline;
background-color: #999;
}
.demoContent{
width:100%;
height:430px;
}
.demoContent article{
max-width: 640px;
margin:0 auto;
height:100%;
text-align: center;
}
@-webkit-keyframes shake {
0%, 100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
10%, 30%, 50%, 70%, 90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0);
}
20%, 40%, 60%, 80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0);
}
}
@keyframes shake {
0%, 100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
10%, 30%, 50%, 70%, 90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0);
}
20%, 40%, 60%, 80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0);
}
}
.demoContent article p{
padding-top: 150px;
font-size: 20px;
margin-bottom: 20px;
-webkit-animation:shake 1s normal linear;
}
.demoContent article a{
display: block;
background-image:-webkit-linear-gradient(#fff,#ffc);
border-radius: 30px;
border: 2px solid #fff;
line-height: 50px;
text-decoration: none;
color:#000;
-webkit-transition:0.2s all ease;
-moz-transition:0.2s all ease;
-ms-transition:0.2s all ease;
-o-transition:0.2s all ease;
transition:0.2s all ease;
}
.demoContent article a:hover{
background-image:-webkit-linear-gradient(#ffc,#fff);
font-size: 18px;
}
.footer{
width:100%;
height:100px;
background:#eee;
}
.footer footer{
max-width:640px;
margin:0 auto;
}
.footer footer p{
line-height:100px;
text-align:center;
}
/*文档样式*/
@media screen and (min-resolution: 2dppx){
*{
font-weight:300;
}
}
.preview{max-width: 640px;margin:0 auto 20px;display: none;}
.preview *{
font-family: Monaco, Menlo, 'Ubuntu Mono', Consolas, source-code-pro, monospace;
}
.preview h1{
margin-bottom: 10px;
}
.preview h3{
font-weight: normal;
font-size: 20px
}
.preview h1:first-child{
margin-top:0;
}
.preview h1 > a,.preview h2 > a,.preview h3 > a,
.preview h4 > a,.preview h5 > a,.preview h6 > a{
color:#000;
cursor:normal;
}
.preview h1 > a::before,.preview h2 > a::before,.preview h3 > a::before,
.preview h4 > a::before,.preview h5 > a::before,.preview h6 > a::before{
content:'';
}
.preview li p{
margin: 0;
margin-left:1em;
}
.preview li p:first-of-type{
margin-left: 0;
}
.preview blockquote{
padding:10px;
margin:10px 0;
background:rgb(247,247,236);
border-left:5px solid rgb(230,230,210);
word-wrap: break-word;
}
.preview blockquote p{
margin:5px 0;
}
.preview a{
color:#2A7ABE;
text-decoration: none;
}
.preview a::before{
content:'☞';
}
.preview code{
font-family: consolas;
}
.preview code *{
font-family: consolas;
}
.preview pre{
display: block;
/*background:rgb(247,247,236);*/
/*border:1px solid rgb(230,230,210);*/
padding:10px;
margin:10px 0;
}
.preview p code,
.preview ul code,
.preview ol code{
background: rgb(247,247,236);
padding:3px;
vertical-align: middle;
border:1px solid rgb(230,230,210);
border-radius: 3px;
}
.preview pre code{
line-height: 1.0em;
font-size:14px;
word-wrap: break-word;
border:0 none;
padding:0;
background: initial;
border-radius: initial;
vertical-align: initial;
}
.preview ul,.preview ol{
list-style-position: inside;
font-size: 16px;
margin-left: 1em;
margin-top:1em;
margin-bottom: 1em;
line-height: 1.6em;
}
.preview ul ul,.preview ol ol,
.preview ul ol,.preview ol ul{
margin-top: 0;
}
.preview ul{
list-style-type: disc;
}
.preview ol{
list-style-type: decimal;
}
.preview img{
max-width: 100%;
border: 1px solid rgb(230,230,210);
padding: 1px;
}
/*
Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #23241f;
}
.hljs,
.hljs-tag,
.css .hljs-rules,
.css .hljs-value,
.css .hljs-function
.hljs-preprocessor,
.hljs-pragma {
color: #f8f8f2;
}
.hljs-strongemphasis,
.hljs-strong,
.hljs-emphasis {
color: #a8a8a2;
}
.hljs-bullet,
.hljs-blockquote,
.hljs-horizontal_rule,
.hljs-number,
.hljs-regexp,
.alias .hljs-keyword,
.hljs-literal,
.hljs-hexcolor {
color: #ae81ff;
}
.hljs-tag .hljs-value,
.hljs-code,
.hljs-title,
.css .hljs-class,
.hljs-class .hljs-title:last-child {
color: #a6e22e;
}
.hljs-link_url {
font-size: 80%;
}
.hljs-strong,
.hljs-strongemphasis {
font-weight: bold;
}
.hljs-emphasis,
.hljs-strongemphasis,
.hljs-class .hljs-title:last-child {
font-style: italic;
}
.hljs-keyword,
.hljs-function,
.hljs-change,
.hljs-winutils,
.hljs-flow,
.lisp .hljs-title,
.clojure .hljs-built_in,
.nginx .hljs-title,
.tex .hljs-special,
.hljs-header,
.hljs-attribute,
.hljs-symbol,
.hljs-symbol .hljs-string,
.hljs-tag .hljs-title,
.hljs-value,
.alias .hljs-keyword:first-child,
.css .hljs-tag,
.css .unit,
.css .hljs-important {
color: #f92672;
}
.hljs-function .hljs-keyword,
.hljs-class .hljs-keyword:first-child,
.hljs-constant,
.css .hljs-attribute {
color: #66d9ef;
}
.hljs-variable,
.hljs-params,
.hljs-class .hljs-title {
color: #f8f8f2;
}
.hljs-string,
.css .hljs-id,
.hljs-subst,
.haskell .hljs-type,
.ruby .hljs-class .hljs-parent,
.hljs-built_in,
.django .hljs-template_tag,
.django .hljs-variable,
.smalltalk .hljs-class,
.django .hljs-filter .hljs-argument,
.smalltalk .hljs-localvars,
.smalltalk .hljs-array,
.hljs-attr_selector,
.hljs-pseudo,
.hljs-addition,
.hljs-stream,
.hljs-envvar,
.apache .hljs-tag,
.apache .hljs-cbracket,
.tex .hljs-command,
.hljs-prompt,
.hljs-link_label,
.hljs-link_url {
color: #e6db74;
}
.hljs-comment,
.hljs-javadoc,
.java .hljs-annotation,
.python .hljs-decorator,
.hljs-template_comment,
.hljs-pi,
.hljs-doctype,
.hljs-deletion,
.hljs-shebang,
.apache .hljs-sqbracket,
.tex .hljs-formula {
color: #75715e;
}
.coffeescript .javascript,
.javascript .xml,
.tex .hljs-formula,
.xml .javascript,
.xml .vbscript,
.xml .css,
.xml .hljs-cdata,
.xml .php,
.php .xml {
opacity: 0.5;
}
body,html{
height:100%;
width:100%;
font-size:0;
}
</style>
</head>
<body>
<!-- <input type="button" value="clickMe" id="btn"/> -->
<div class="header" style="width:100%">
<header class="header_content">
<a href="https://github.com/ddian/AlertBox" target = "_blank">View on GitHub</a>
<h1>AlertBox</h1>
<h2>A cool confirm component</h2>
</header>
</div>
<div class="demoContent" id="demoContent">
<article>
<p>
Try to click the follow button!
<br/>
First experience it then get the details!
</p>
<a href="javascript:;" id="btn">
I'm a button,click me and confirm you will get surprise!
</a>
</article>
</div>
<div class="preview" id="preview">
<h1 class="line" data-line="0">
<a name="anchor0" style="font-size:30px">弹框使用说明</a>
</h1>
<h3 class="line" data-line="1">
<a name="anchor1">功能</a>
</h3>
<ul>
<li>
<p>弹框组件</p>
</li>
</ul>
<h3 class="line" data-line="5">
<a name="anchor2">特性</a>
</h3>
<ul>
<li>
<p>提供自定义提示内容</p>
</li>
<li>
<p>焦点管理</p>
</li>
<li>
<p>可拖拽</p>
</li>
</ul>
<h3 class="line" data-line="11">
<a name="anchor3">用法</a>
</h3>
<ul>
<li>
<p>My_AlertBox为构造函数,需要new一个实例new My_AlertBox(string,callback)</p>
</li>
<li>
<p>调用实例方法alertConfirm()可让弹框出现</p>
</li>
<li>
<p>调用实例方法alertDestroy()可让弹框消失</p>
</li>
</ul>
<h3 class="line" data-line="16">
<a name="anchor4">参数:string</a>
</h3>
<ul>
<li><p>传入的字符串为弹框中出现的提示内容</p></li>
</ul>
<h3 class="line" data-line="20">
<a name="anchor5">参数:callback</a>
</h3>
<ul>
<li><p>传入的callback函数可以自定义</p></li>
</ul>
<h3 class="line" data-line="24">
<a name="anchor6">Demo 一分钟教你写弹框</a>
</h3>
<p class="line" data-line="26">
1、 新建一个HTML文件,为弹框准备一个可点击的按钮。
</p>
<ul>
<li><p>HTML</p></li>
</ul>
<pre class=" hljs vim"><code><<span class="hljs-built_in">input</span> <span class="hljs-built_in">type</span>=<span class="hljs-string">"button"</span> value=<span class="hljs-string">"按钮"</span> id=<span class="hljs-string">"btn"</span>/>
</code></pre>
<p class="line" data-line="32">2、 引入css、js文件</p>
<pre class=" hljs xml"><code><span class="hljs-tag"><<span class="hljs-title">link</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">"css/alertBox.css"</span> <span class="hljs-attribute">rel</span> = "<span class="hljs-attribute">stylesheet</span>" <span class="hljs-attribute">type</span>=<span class="hljs-value">"text/css"</span>/></span>
<br/><span class="hljs-tag"><<span class="hljs-title">script</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">"javascript/text"</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">"alertBox.js"</span>></span><span class="javascript"></span><span class="hljs-tag"></<span class="hljs-title">script</span>></span>
</code></pre>
<p class="line" data-line="40">3、创建<script></script>,绑定事件</p>
<pre class=" hljs javascript"><code><span class="hljs-keyword">var</span> btn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'btn'</span>);
btn.addEventListener(<span class="hljs-string">'click'</span>,alertEvent,<span class="hljs-literal">false</span>);
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">alertEvent</span><span class="hljs-params">()</span></span>{
<span class="hljs-keyword">var</span> box1 = <span class="hljs-keyword">new</span> My_AlertBox(<span class="hljs-string">'第一个弹框'</span>,<span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">()</span></span>{
<span class="hljs-keyword">var</span> box2 = <span class="hljs-keyword">new</span> My_AlertBox(<span class="hljs-string">'第二个弹框'</span>,<span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">()</span></span>{
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'成功了'</span>)
});
box2.alertConfirm();
});
box1.alertConfirm();
}
</code></pre>
</div>
<div class="footer">
<footer>
<p>
get the details click it
<a href="https://github.com/ddian/AlertBox" target = "_blank">GitHup</a>
</p>
</footer>
</div>
<script src="js/alertBox.js"></script>
<script>
(function(){
'use strict';
var btn = document.getElementById('btn');
var demoContent = document.getElementById('demoContent');
var preview = document.getElementById('preview');
function confirmEvent(){
var box1 = new My_AlertBox('Are you sure to continue?',function(){
var box2 = new My_AlertBox('you will to continue',function(){
demoContent.style.display = 'none';
preview.style.display = 'block';
});
box2.alertConfirm();
});
box1.alertConfirm();
}
btn.addEventListener('click',confirmEvent,false);
})();
</script>
</body>
</html>