-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathindex.html
618 lines (555 loc) · 15 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
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
<!DOCTYPE HTML>
<html style="font-size:50px;">
<head>
<meta charset="UTF-8">
<meta name="viewport" content=" initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name = "format-detection" content = "telephone=no">
<title>js-xxy-popup Dome</title>
<style>
*{margin:0;padding:0;list-style:none;}
blockquote,body,button,dd,dl,dt,fieldset,form,h1,h2,h3,h4,h5,h6,hr,input,legend,li,ol,p,pre,td,textarea,th,ul{margin:0;padding:0;}
body,button,input,select,textarea{font:12px/1.5 tahoma,arial,\5b8b\4f53,sans-serif;}
h1,h2,h3,h4,h5,h6{font-size:100%;}
address,cite,dfn,em,var{font-style:normal;}
code,kbd,pre,samp{font-family:courier new,courier,monospace;}
small{font-size:12px;}
ol,ul{list-style:none;}
a{text-decoration:none;}
a:hover{text-decoration:underline;}
body{
height:2000px;
font-size:16px;
background: #eee;
color: #333;
}
.header {
background-color: #fff;
padding: 40px 0 30px;
background-image: linear-gradient(-30deg,rgba(238, 238, 238, 0.42,rgba(52, 121, 189, 0.32)));
background-image: -webkit-linear-gradient(-30deg,rgba(238, 238, 238, 0.42),rgba(52, 121, 189, 0.32));
}
.wrapper {
box-sizing: border-box;
max-width: 1200px;
min-width: 320px;
margin: 0 auto;
padding: 0 15px;
}
.project-title {
font-size: 24px;
font-weight: 400;
margin-bottom: 15px;
}
.project-description {
font-size: 15px;
margin-bottom: 25px;
}
.project-description p {
margin-bottom: 10px;
}
.button-group {
font-size: 0;
}
.button-group .button {
margin-right: 10px;
margin-bottom: 10px;
}
.button-default {
color: #6064ad;
border: 1px solid #6064ad;
}
.button {
overflow: hidden;
position: relative;
display: inline-block;
height: 38px;
line-height: 38px;
padding: 0 20px;
font-size: 14px;
border-radius: 2px;
}
.main-content :first-child {
margin-top: 0;
}
button, .upbtn {
position: relative;
overflow: visible;
display: inline-block;
padding: 0.5em 1em;
border: 1px solid #d4d4d4;
margin: 0;
text-decoration: none;
text-align: center;
font: 11px/normal sans-serif;
color: #333;
white-space: nowrap;
cursor: pointer;
outline: none;
background-color: #ececec;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f4f4f4), to(#ececec));
background-image: -moz-linear-gradient(#f4f4f4, #ececec);
background-image: -ms-linear-gradient(#f4f4f4, #ececec);
background-image: -o-linear-gradient(#f4f4f4, #ececec);
background-image: linear-gradient(#f4f4f4, #ececec);
-moz-background-clip: padding;
background-clip: padding-box;
border-radius: 0.2em;
zoom: 1;
}
.module-test-list-title{
font-size: 15px;
}
a {
display: block;
color: #1e6bb8;
text-decoration: none;
}
.title{
color: inherit;
}
.touchs {
font-weight: 600;
margin: 1em 0;
}
.touchs .mask{
overflow: hidden;
height: 20px;
margin-top: 6px;
}
.touchs .mask:after {
content: '';
display: block;
margin: -25px auto 0;
width: 100%;
height: 25px;
/* border-radius: 125px/12px; */
box-shadow: 0 0 8px rgba(0,0,0,.3);
}
#comlist{
height: 300px;
width: 5rem;
<!-- display: none; -->
}
.list{
height:600px;
text-align: center;
line-height: 4em;
background-image: repeating-linear-gradient(30deg, hsla(0,0%,100%,.1), hsla(0,0%,100%,.1) 15px, transparent 0, transparent 30px);
background-color:#58a;
}
.jscode{
padding: 0 1em 0 2em;
box-sizing: border-box;
word-break:break-all;
font-size: 13px;
}
.jscode textarea{
width: 100%;
height: 8em;
line-height: 1em;
background: rgba(0,0,0,0);
border-width: 0px
}
.jscode ol{
line-height: 2em;
}
@media only screen and (min-width: 768px){
.main {
box-sizing: border-box;
width: 75%;
padding-right: 20px;
float: left;
}
.wrapper {
padding: 0 15px;
}
.sidebar {
box-sizing: border-box;
width: 25%;
float: right;
}
.content .wrapper {
margin: 0 auto;
}
.wrapper {
padding: 0 50px;
width: 85%;
}
.content{
overflow: hidden;
margin: auto;
width: 83%;
}
}
.content{
overflow: hidden;
}
.section-heading .section-title {
font-weight: 400;
font-size: 22px;
color: #666;
}
.section-heading {
padding: 20px 0;
}
.section-heading {
overflow: hidden;
text-align: left;
padding: 20px 15px;
}
.content .wrapper {
margin-left: -15px;
margin-right: -15px;
}
.content-block {
background-color: #fff;
padding: 15px;
margin-bottom: 20px;
}
.content-block .subtitle {
font-size: 14px;
font-weight: 400;
word-wrap: break-word;
word-break: break-all;
-ms-word-break: break-all;
word-break: break-word;
color: #999;
margin-bottom: 10px;
}
a {
-webkit-transition: -webkit-transform 1s;
transition: transform 1s;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.history-version {
position: relative;
list-style: none;
margin: 0;
}
.history-version li {
padding: 5px 0 5px 15px;
position: relative;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.history-version li:before {
content: "";
position: absolute;
top: 50%;
left: -2px;
z-index: 10;
margin-top: -5px;
display: block;
width: 6px;
height: 6px;
background-color: #ccc;
border: 2px solid #fff;
border-radius: 999px;
}
.history-version .version {
width: 40px;
margin-right: 10px;
}
.history-version .time {
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
color: #999;
font-size: 13px;
}
.history-version:after {
content: '';
position: absolute;
top: 12px;
bottom: 15px;
left: 2px;
width: auto;
height: auto;
z-index: 0;
border-left: 2px solid #ccc;
}
.content-block {
padding: 15px;
margin-bottom: 20px;
background-image: repeating-linear-gradient(30deg, hsla(0,0%,100%,.1), hsla(0,0%,100%,.1) 15px, transparent 0, transparent 30px);
background-color: rgba(30, 107, 184, 0.12);
}
.main-inner{
max-width: 400px;
}
code{
display: block;
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: #f6f8fa;
border-radius: 3px;
background: linear-gradient(45deg,transparent 45%,rgba(0,0,0,.01) 45%,rgba(0,0,0,.01) 55%,transparent 55%),linear-gradient(135deg,transparent 45%,rgba(0,0,0,.01) 45%,rgba(0,0,0,.01) 55%,transparent 55%),linear-gradient(45deg,transparent 20px,rgba(0,0,0,.01) 20px,rgba(0,0,0,.01) 21px,transparent 21px),linear-gradient(135deg,transparent 20px,rgba(0,0,0,.01) 20px,rgba(0,0,0,.01) 21px,transparent 21px),linear-gradient(#fef5f4,#fef5f4);
background-size: 10px 10px,10px 10px,30px 30px,30px 30px,cover;
}
h2>A{
color: #333;
border-bottom: 2px solid rgba(0,0,0,.2);
}
h4{
padding: 1em 0;
}
code{
color: #777;
}
</style>
</head>
<body>
<header class="header">
<div class="wrapper clearfix">
<h1 class="project-title">XXY 轻量级的WEB移动端框架</h1>
<div class="project-description">
<p>这是一款轻量级的WEB移动端框架,包括常见的 alert、popup、toast 三种类型弹窗,没有第三方库依赖。</p>
</div>
<div class="project-follow">
<div class="button-group">
<a target="_self" href="#install" class="button button-default">GET STARTED</a>
<a target="_blank" href="https://github.com/0123cf/xxy" class="button button-default">GitHub</a>
</div>
</div>
</div>
</header>
<div class="content">
<div class="wrapper clearfix">
<section class="section-heading">
<h2 class="section-title">演示</h2>
</section>
<div class="main">
<div class="content-block">
<div class="main-inner">
<div class="touchs">
弹窗
<div class="mask"></div>
</div>
<button onclick="popup()">popup</button>
<button onclick="alertk()">alert</button>
<button onclick="toast()">toast</button>
<br />
<br />
<div class="touchs">
使用例子
<div class="mask"></div>
</div>
<a target="_Blank" class="title">
<button onclick="testphone()">弹窗取值</button>
</a>
<br />
<br />
<div class="touchs">
下拉刷新、上拉加载
<div class="mask"></div>
</div>
<!-- 上下拉例子 start -->
<div id="comlist" class="xxy-down-viewbox comlist">
<div class="view" data-befor = "下拉刷新" data-after = "上拉加载" >
<div class="inner">
<!-- 自定义内容 -->
<ul class="list">
</ul>
<!-- 自定义内容 -->
</div>
</div>
</div>
<!-- 上下拉列子 end -->
<br />
<br />
<div class="touchs">
轮播
<div class="mask"></div>
</div>
<!--轮播 start-->
<style>
#banner-wrap{
position:relative;overflow:hidden;
}
#banner-wrap>ul>li{
float: left;
}
#banner-wrap>ul>li>div{
height: 200px;
background-image: repeating-linear-gradient(30deg, hsla(0,0%,100%,.1), hsla(0,0%,100%,.1) 15px, transparent 0, transparent 30px);
background-color: #58a;
}
/* 小圆点 */
#banner-wrap>#point{position:absolute;bottom:6px;width:100%;text-align:center;}
#banner-wrap>#point span{display:inline-block;margin:0 4px;width:6px;height:6px;border-radius:50%;background-color:#b0b0b0;}
#banner-wrap>#point span.active{background-color:#F06333;}
/*icon
#banner-wrap .touch{position:absolute;top:0;bottom:0;z-index:2;margin:auto 0;width:30px;height:30px;}
#banner-wrap .icon{width:30px;height:30px;background:rgba(0,0,0,0);vertical-align:middle;fill:rgba(255,255,255,.8);}
#banner-wrap .left{left:1px;}
#banner-wrap .right{right:1px;}
*/
</style>
<div id="banner-wrap">
<ul>
<li>
<div>1</div>
</li>
<li>
<div>2</div>
</li>
<li>
<div>3</div>
</li>
</ul>
<!--左右切换 (非必须)stert-->
<!--<div id="slider-left" class="touch left">
<svg v-on:click="go" t="1492745076763" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2359" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs></defs><path d="M480.591151 216.192877" p-id="2360"></path><path d="M475.940225 175.233" p-id="2361"></path><path d="M369.112174 514.863211l381.074112-379.929032c13.155624-13.132088 13.155624-34.387181 0-47.494711l-11.905144-11.879562c-13.179161-13.107529-34.485419-13.107529-47.642067 0l-416.844803 415.544181c-13.131065 13.131065-13.131065 34.388205 0 47.51927l416.844803 415.544181c13.155624 13.106506 34.511002 13.106506 47.642067 0l11.905144-11.879562c13.155624-13.107529 13.155624-34.362622 0-47.51927L369.112174 514.863211z" p-id="2362"></path></svg>
</div>
<div id="slider-right" class="touch right">
<svg t="1498121050750" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2366" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M317.20358 1023.807475 245.969467 959.619764 648.615477 512 245.969467 64.380236 317.20358 0.192525 777.606979 512 317.20358 1023.807475Z" p-id="2367"></path></svg>
</div>-->
<!--左右切换 end-->
</div>
<!--轮播end-->
<br />
<br />
<h2><a name="install">Install</a></h2>
<h4>NPM</h4>
<div>
<code>npm install xxy</code>
</div>
<h4>SRC</h4>
<div>
<code>https://0123cf.github.io/xxy/xxy.js</code>
</div>
<br />
<br />
</div>
</div>
</div>
<aside class="sidebar">
<!-- S content-block -->
<div class="content-block">
<div class="subtitle">反馈 BUG</div>
<p><a target="_blank" href="https://github.com/0123cf/xxy/issues">GiHub issues</a></p>
</div>
<!-- E content-block -->
<!-- S content-block -->
<div class="content-block">
<div class="subtitle">依赖</div>
<p>无</p>
</div>
<!-- E content-block -->
<!-- S content-block -->
<div class="content-block">
<div class="subtitle">npm版本</div>
<ul class="history-version">
<li><span class="version">v1.0.2</span><span class="time">准备中...</span></li>
<li><span class="version">v1.0.1</span><span class="time">2017-06-16</span></li>
<li><span class="version">v1.0.0</span><span class="time">2016-08-10</span></li>
</ul>
</div>
<!-- E content-block -->
<!-- S content-block -->
<div class="content-block">
<div class="subtitle">协议</div>
<p>MIT</p>
</div>
<!-- E content-block -->
</aside>
</div>
</div>
</body>
<script src="xxy.js"></script>
<script>
// 配置
var config = {
mask: .3,
skin: 'ios',
an: true
};
xxy.config(config)
function popup(){
xxy.popup('小提示','您觉得xxy弹窗做的如何?','好','不好',function(e){
if(e==0){
xxy.toast('谢谢的你支持!');
}else{
xxy.toast('xxy会继续加油↖(^ω^)↗')
}
})
}
function alertk(){
xxy.alert('这是alert弹窗',function(){
xxy.toast('done')
})
}
function toast(){
xxy.toast('正在开启wifi')
}
// 手机号绑定
function testphone(tips){
var tips= tips?tips:''
xxy.popup(
'手机号绑定',
'<input style="margin:.5em 0;padding: .2em;border-width:0px;border:1px solid #ddd; box-sizing: border-box;width:100%;" onchange="xxy.v1= this.value" />'+
'<span style="color:#880707">'+tips+'</span>',
'绑定',
'取消',
function(e){
if(e==0){
if(!xxy.v1){
testphone("未输入手机号!");
return false;
}
if(xxy.v1.length<=1){
testphone("未输入手机号!")
return false
}
if(!(/^1[34578]\d{9}$/.test(xxy.v1))){
testphone("手机号码有误,请重填")
return false
}
xxy.toast('验证成功')
}else{
xxy.toast('已取消')
}
}
);
}
// 上拉拉动
var test= new xxy.touch()
test.bind(document.querySelector('#comlist'),{
move: true,
up: function(){
window.setTimeout(function(){
this.done()
xxy.toast('加载成功')
}.bind(this),3000)
},
down: function(){
window.setTimeout(function(){
this.done()
xxy.toast('刷新成功')
}.bind(this),1000)
}
})
// 轮播
var slidera = xxy.slider()
var config = {
// 非必须
time: 10*1000
}
slidera.bind(document.querySelector("#banner-wrap"),config)
slidera.on('gap',function(e){
// 这是手指滑动的距离
console.log(e)
})
if(window.innerWidth>700){
xxy.toast('查看演示请按F12打开手机模式',100*1000);
}
</script>
</html>