-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathdemo.html
412 lines (398 loc) · 9.26 KB
/
demo.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
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<title>UI_demo</title>
<!-- <style type="text/css">
html,body{
background:#eee;
margin:0px;
padding:0px;
position: relative;
height: 100%;
overflow: hidden;
font-family:"Microsoft Yahei";
}
a{
text-decoration:none;
}
#wrapper{
position: relative;
top:0px;
left:0px;
width: 100%;
height: 100%;
overflow: scroll;
}
-->
<style type="text/css">
html,body{
background:#eee;
margin:0px;
padding:0px;
font-family:"Microsoft Yahei";
}
a{
text-decoration:none;
}
#wrapper{
position: relative;
top:0px;
left:0px;
width: 100%;
}
#loading_mask{
position: absolute;
position: fixed;
top:0px;
left:0px;
width: 100%;
height: 100%;
background: #333;
}
.loading_mask_txt{
position: absolute;
top:50%;
left:0px;
width: 100%;
height: 40px;
margin-top: -20px;
text-align: center;
letter-spacing: 5px;
color: #ccc;
font-size: 24px;
}
.cpt {
padding: 50px 0px 20px;
margin-bottom: 30px;
text-align: center;
background: #333;
border-bottom: 1px solid #fff;
box-shadow:0px 0px 20px #fff;
}
.cpt h1{
margin:0px;
font-weight:normal;
font-size: 28px;
letter-spacing: 5px;
color:#fff;
}
.cpt p{font-size:14px;color:#666;}
.cpt b{
padding: 0px 5px;
font-size:18px;
color:#eee;
font-weight:normal;
}
.cpt i{
color:#ccc;
padding:0px 5px;
}
.cnt{max-width:460px;margin:auto;padding-bottom:200px;}
.demoItem{
margin: 0px 10px 20px;
background: #fff;
border-radius:4px;
overflow: hidden;
box-shadow: 1px 1px 3px rgba(0,0,0,0.7)
}
.demoItem h3{
line-height:30px;
margin:0px;
padding: 5px 0px;
text-align: center;
color: #eee;
font-size: 17px;
font-weight: normal;
background: #444;
}
.btnList{
width: 100%;
overflow: hidden;
}
.btnList a{
display: block;
height: 40px;
line-height: 40px;
text-align:center;
border-top: 1px solid #ddd;
margin-top: -1px;
color: #666;
font-size: 14px;
transition: 0.3s;
}
.btnList a:hover{
background: #f4f4f4;
color: #222;
}
.btnList a:active{
background: #ccc;
color: #222;
}
/****/
.btnConf{
padding: 10px 5px;
text-align: center;
background: #fff;
}
.btnConf a{
display: inline-block;
font-size: 14px;
color : #aaa;
margin-right: 10px;
padding: 0px 10px;
line-height: 24px;
}
.btnConf a span{
color: #fff;
font-weight: bold;
margin-right: 10px;
}
.btnConf a.isSelected{
color: #333;
background: #ccc;
}
.btnConf a.isSelected span{
color: #000;
}
#config_panle{
position: fixed;
top: 10%;
right: 20px;
width: 120px;
}
</style>
</head>
<body>
<div id="wrapper">
<div class="cpt">
<h1>响应式用户交互组件库</h1>
<p>当前为<b>等待响应状态</b><i>正在检测尺寸</i>(分界线640px)</p>
</div>
<div class="cnt">
<div class="demoItem">
<h3>弹框</h3>
<div class="btnConf">
<a href="javascript:void(0)" onclick="toggleParam(this,'title','标题出来了',null)" ><span>√</span>标题</a>
<a href="javascript:void(0)" onclick="toggleParam(this,'confirm',true,false)"><span>√</span>confirm</a>
</div>
<div class="btnList">
<a href="javascript:void(0)" onclick="showPop(this)">显示</a>
</div>
</div>
<div class="demoItem">
<h3>浮层</h3>
<div class="btnList">
<a href="javascript:void(0)" onclick="showCover(this)" >全屏</a>
<a href="javascript:void(0)" onclick="showPlane(this)" >屌丝层</a>
</div>
</div>
<div class="demoItem">
<h3>对话框</h3>
<div class="btnList">
<a href="javascript:void(0)" onclick="showConfirm(this)" >确认</a>
<a href="javascript:void(0)" onclick="showAsk(this)" >询问</a>
</div>
</div>
<div class="demoItem">
<h3>提示信息</h3>
<div class="btnList">
<a href="javascript:void(0)" onclick="showPrompt(this,'我快死了')" >默认(3s关闭)</a>
<a href="javascript:void(0)" onclick="showPrompt(this,'我快死了',500)" >指定时间(0.5s关闭)</a>
<a href="javascript:void(0)" onclick="showMessage(this)" >一直显示(别点)</a>
</div>
</div>
<div class="demoItem">
<h3>选择列表(响应式)</h3>
<div class="btnList">
<a href="javascript:void(0)" onclick="showSelect(this)" >侬想组啥?</a>
</div>
</div>
</div>
</div>
<div id="config_panle">
<div class="btnConf">
<a href="javascript:void(0)" onclick="toggleParam(this,'mask',true,false)" class="isSelected"><span>√</span>蒙层</a>
<a href="javascript:void(0)" onclick="toggleParam(this,'easyClose',true,false)" class="isSelected"><span>√</span>easyClose</a>
</div>
</div>
<div id="loading_mask">
<div class="loading_mask_txt">
正在加载……
</div>
</div>
<script type="text/javascript" src="dialog.js"></script>
<script type="text/javascript">
var param = {
'easyClose' : true,
'mask' : true
};
function toggleParam(elem,type,value,defaultValue){
if(param[type]){
param[type] = defaultValue;
UI._utils.removeClass(elem,'isSelected');
}else{
UI._utils.addClass(elem,'isSelected');
param[type] = value;
}
}
//弹框
var active_pop = null;
function showPop(elem){
if(active_pop){
return
}
active_pop = UI.pop({
'title' : param.title,
'confirm' : param.confirm,
'width' : 600,
'easyClose' : param.easyClose,
'mask' : param.mask,
'html' : '<div style="height:280px;background:url(http://layasset.qiniudn.com/images/cover/newSkin.jpg) no-repeat center"></div>'
});
active_pop.on('destroy', function(){
active_pop = null;
});
}
/**
* 确认框
*/
var active_confirm = null;
function showConfirm(elem){
if(active_confirm){
return;
}
active_confirm = UI.confirm({
'text' : '请我吃饭吧!',
'btns' : ['好的呀','不愿意'],
'easyClose' : param.easyClose,
'mask' : param.mask,
callback : function(){
UI.prompt('你是好人!');
// return false
},
cancel: function(){
UI.prompt('真抠门儿!');
// return false
}
});
active_confirm.on('destroy', function(){
active_confirm = null;
});
}
var active_prompt = null;
function showMessage(elem){
if(active_prompt){
elem.innerHTML = '一直显示(别点)';
active_prompt.destroy();
active_prompt = null;
}else{
elem.innerHTML = '想关掉它,点我啊';
active_prompt = UI.prompt('再点一下按钮,关掉我',0);
}
}
function showPrompt(elem,title,time){
UI.prompt( title, time );
}
var active_select = null;
function showSelect(elem){
var offset = UI._utils.offset(elem);
if(active_select) {
return
}
active_select = UI.select([
['劈脸呼你',function(){
UI.prompt('脸好疼');
}],
['一刀捅死你',function(){
UI.prompt('啊,我死了');
}],
['滚一边去',function(){
UI.prompt('滚远了');
}]
],{
'title' : '侬想组啥?',
'intro' : '来一帮人,想打架么',
'top' : offset.top + UI._utils.outerHeight(elem),
'width' : 300,
'left' : offset.left + 30,
'easyClose' : param.easyClose,
'mask' : param.mask
});
active_select.on('destroy', function(){
active_select = null;
});
}
function showPlane(elem){
var offset = UI._utils.offset(elem);
var param1 = {
'top' : offset.top + UI._utils.outerHeight(elem),
'left' : offset.left + 30,
'easyClose' : param.easyClose,
'html' : '<div style="padding:20px 30px;background:#333;color:#fff;">我是屌丝</div>'
};
UI.plane(param1);
}
function showCover(elem){
var param1 = {
'mask' : param.mask,
'easyClose' : param.easyClose,
'html' : '<table width="100%" height="100%"><tr><td style="text-align:center;vertical-align:middle;"><img src="http://layasset.qiniudn.com/labs/UI.jpg" /></td></tr></table>'
};
UI.cover(param1);
}
var active_ask = null;
function showAsk(elem){
if(active_ask) {
return
}
active_ask = UI.ask('你今年多大了?',function(year){
if(year && year == +year){
if(year > 30){
UI.prompt('都' + year + '岁了啊,这么老啊!');
}else if(year > 17){
UI.prompt(year + '岁呀,干柴烈火的年纪哦!');
}else{
UI.prompt('才' + year + '岁啊,回家玩儿去!');
}
}else{
UI.prompt('写个数字会死啊!');
return false
}
},{
'easyClose' : param.easyClose,
'mask' : param.mask
});
active_ask.on('destroy', function(){
active_ask = null;
});
}
var bodyDom;
if (document.compatMode == "BackCompat") {
bodyDom = document.body;
}else{
bodyDom = document.documentElement;
}
function countSize(){
var width = bodyDom.clientWidth;
var numDom = document.getElementsByTagName('i')[0];
var deviceDom = document.getElementsByTagName('b')[0];
numDom.innerHTML = width + 'px';
if(width > 640){
deviceDom.innerHTML = 'WEB端';
}else{
deviceDom.innerHTML = '手机端';
}
}
UI._utils.ready(function(){
countSize();
UI._utils.bind(window,'resize',countSize);
var loadingDom = document.getElementById('loading_mask');
setTimeout(function(){
UI._utils.fadeOut(loadingDom,500);
},200);
});
</script>
</body>
</html>