-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlider.html
406 lines (362 loc) · 11.8 KB
/
Slider.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>mooTipsy</title>
<link rel="stylesheet" href="css/asdui1.4b.css" type="text/css" media="all" />
<style type="text/css">
a:link,a:visited{color:#f00; text-decoration:underline}
fieldset{margin:20px 10px}
pre{border:1px solid #fc0;background:#ffd;padding:5px}
fieldset{margin:20px;padding:20px;text-align:left}
fieldset legend{padding:5px 10px;font-weight:700;font-size:16px}
table{color:#333;background:#E8F5FE;border-collapse:collapse;width:100%;text-align:left;}
thead{}
thead th{padding:1em 1em .5em;border:1px solid #5C9CC0;font-size:120%;background:#5C9CC0;text-align:left}
thead tr{}
td{padding:.5em 1em;border:1px solid #BBE1F1}
tbody td{background:#EEFAFF;}
tfoot{background-color:#A9C9E2;}
tfoot td{padding-bottom:1.5em;border:1px solid #BBE1F1}
dl{padding:10px 5px}
dl dt{font-weight:700;font-sie:14px;padding:5px 0;}
dl dt span{color:#f60;padding:0 8px}
pre{border:1px solid #ADCD3C;background-color:#F2FDDB;padding:5px;white-space: pre-wrap;
word-wrap: break-word;}
.animate:nth-child(2){
-webkit-transition-delay: 1s;
-moz-transition-delay: 1s;
-o-transition-delay: 1s;
-ms-transition-delay: 1s;
transition-delay: 1s;
}
.animate:nth-child(3){
-webkit-transition-delay: 0.5s;
-moz-transition-delay: 0.5s;
-o-transition-delay: 0.5s;
-ms-transition-delay: 0.5s;
transition-delay: 0.5s;
}
.SL_box3{ color: #ccc;
display: inline-block;
height: 180px;
overflow: hidden;
padding: 10px;
position: absolute;
text-align: justify;
width: 680px;}
#SLin2 .SL_box{position:absolute}
</style>
</head>
<body>
<fieldset>
<legend>ASDUI.SL demo</legend>
<div id="output" style="border:2px solid blue;background:#fff;width:300px;height:50px;position:absolute;right:10px;top:40px;"></div>
<div id="SL" style="width:700px;border:1px solid #f00;background:none">
<div id="Slin" style="width:700px;margin:0 auto;position:relative">
<div class="SL_box" id="S1" style="background:#F60;color:#fff">
<!--<h2 class="animate">First article1</h2>
<p class="animate">Some description</p>-->
11111
</div>
<div class="SL_box" id="S2" style="background:#060">
<!--<h2 class="animate">First article2</h2>
<p class="animate">Some description</p> -->
2222
</div>
<div class="SL_box" id="S3" style="background:#f30;color:#fff">
<!--<h2 class="animate">First article3</h2>
<p class="animate">Some description</p> -->
33333
</div>
<div class="SL_box" id="S4" style="background:#000;color:#fff">
<!--<h2 class="animate">First article4</h2>
<p class="animate">Some description</p> -->
4444
</div>
</div>
</div>
<a href="javascript:void(0)" id="prev"><上一个</a> | <a href="javascript:void(0)" id="next">下一个></a> | <a href="javascript:void(0)" onClick="Sl.goToSlide(2)">跳转到第3个</a> | <a href="javascript:void(0)" id="CgSL">动态改变</a>
<div class="SL_nav" id="SL_nav">
<!-- <a href="#" title="Click to navigate" class="active"></a>
<a href="#" title="Click to navigate" class=""></a>
<a href="#" title="Click to navigate" class=""></a>
<a href="#" title="Click to navigate" class=""></a>-->
</div>
</fieldset>
<fieldset>
<legend>ASDUI.SL fade demo</legend>
<div id="SL2" style="position:relative;width:500px;height:250px">
<div id="SLin2">
<!-- this is an article -->
<div class="SL_box" style="background:#fc0;color:#fff">
<h2>1111111111</h2>
<p>Some description</p>
<div class="SL_info">1111111</div>
</div>
<div class="SL_box">
<h2>22222222222</h2>
<p>Some description</p>
<div class="SL_info">2222222</div>
</div>
<div class="SL_box" id="dltMe" style="background:#f30;color:#fff">
<h2>333333333</h2>
<p>Some description</p>
<div class="SL_info">33333333</div>
</div>
</div>
</div>
<div class="SL_nav" id="SL_nav2">
<a href="#" title="Click to navigate" class="active"></a>
<a href="#" title="Click to navigate" class=""></a>
<a href="#" title="Click to navigate" class=""></a>
</div>
</fieldset>
<h2>自动宽高slider</h2>
<div id="SL3" style="position:relative;width:90%;margin:0 auto;overflow:hidden;height:250px">
<div id="SLin3" style="width:100%;height:100%;">
<!-- this is an article -->
<div class="SL_box2" style="background:#fc0;color:#fff">
<h2>1111111111</h2>
<p>Some description</p>
</div>
<div class="SL_box2" style="background:#00F;color:#fff">
<h2>22222222222</h2>
<p>Some description</p>
</div>
<div class="SL_box2" style="background:#f30;color:#fff">
<h2>333333333</h2>
<p>Some description</p>
</div>
</div>
</div>
<div class="SL_nav" id="SL_nav3">
<a href="#" title="Click to navigate" class="active"></a>
<a href="#" title="Click to navigate" class=""></a>
<a href="#" title="Click to navigate" class=""></a>
</div>
<h2>Carousel</h2>
<fieldset><legend>ASDUI.SL.Class</legend>
<dl>
<dt>调用方法:</dt>
<dd>
<pre>var myshake = new ASDUI.SL(element[, options]);</pre>
</dd>
<dt>一个藏袍:</dt>
<dd>
<pre>
new ASDUI.SL('SL',{
moveBox: 'SL',
slides: '.SL_box',
slideDuration:5000,
effectDuration:1000,
fadeDist:600,
fadePosition:'left',
stopSlideOnClick: false,
autoSlide: true,
navigationNums: false // if true, numbers will appear
});
</pre>
</dd>
</dl>
<table>
<col id="middle" />
<col />
<col />
<thead>
<tr><th>Option</th>
<th>参数描述</th></tr>
</thead>
<tfoot>
</tfoot>
<tbody>
<tr>
<td>moveBox</td>
<td>幻灯片第二层容器Id</td>
</tr>
<tr>
<td>slides[s]</td>
<td>需要切换的内容容器(选择器)</td>
</tr>
<tr>
<td>slideDuration</td>
<td>切换的时间间隔</td>
</tr>
<tr>
<td>effectDuration</td>
<td>切换效果时间</td>
</tr>
<tr>
<td>effect</td>
<td>切换时的效果,默认为Fx.Transitions.linear</td>
</tr>
<tr>
<td>fadeDist</td>
<td>切换时的水平或垂直改变值;默认值为null,为null时自动获取父容器宽度高度数值作为参照;</td>
</tr>
<tr>
<td>fadePosition</td>
<td>切换的方向;暂时只支持left,top,fade</td>
</tr>
<tr>
<td>autoSlide</td>
<td>是否自动切换,默认为true</td>
</tr>
<tr>
<td>navbox</td>
<td>幻灯片导航容器,可为空,但是若启用容器内子元素个数必须跟幻灯片个数对等</td>
</tr>
<tr>
<td>navigationNums</td>
<td>是否在导航按钮中显示序号,默认为false</td>
</tr>
<tr>
<td>circle</td>
<td>slider之间切换是否首尾连续,默认值false</td>
</tr>
<tr>
<td>autoSize</td>
<td>是否允许slider宽高以及切换深度随页面大小变化而变化默认值为false</td>
</tr>
<tr>
<td>onStart(fn)</td>
<td>幻灯片滑动前执行的回调函数</td>
</tr>
<tr>
<td>onFinish(fn)</td>
<td>幻灯片滑动完成后执行的回调函数</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<dl>
<dt>外置方法:<span>.goToSlide(num);</span>跳转到第num个幻灯片</dt>
<dd>
<pre>
Sl = new ASDUI.SL();
Sl.goToSlide(3);
</pre>
</dd>
<dt>外置方法:<span>.next();</span>跳转到下一个幻灯片</dt>
<dd>
<pre>
Sl = new ASDUI.SL();
Sl.next();;
</pre>
</dd>
<dt>外置方法:<span>.prev();</span>跳转到上一个幻灯片</dt>
<dd>
<pre>
Sl = new ASDUI.SL();
Sl.prev();
</pre>
</dd>
<dt>外置方法:<span>.prepareSlides(A);</span>重新构建幻灯片,且默认显示第A个;本方法用于动态删除了幻灯片和resize后重新构建当前幻灯片</dt>
<dd>
<pre>
Sl = new ASDUI.SL();
Sl.prepareSlides(1);
</pre>
</dd>
<dt>外置方法:<span>.getCurrent();</span>获取当前幻灯片显示的slider对象</dt>
<dd>
<pre>
Sl = new ASDUI.SL();
Sl.getCurrent();//return slider object
</pre>
</dd>
<dt>外置方法:<span>.getNum();</span>获取当前幻灯片显示的slider的序列</dt>
<dd>
<pre style="right:inherit">
Sl = new ASDUI.SL();
Sl.getNum();//return number
</pre>
</dd>
</dl>
</fieldset>
<script type="text/javascript" src="js/jquery1.91.min.js"></script>
<script src="js/asdui.js" type="text/javascript"></script>
<script type="text/javascript">
Sl = new ZUI.SL($('#SL'),{
moveBox:'Slin',
slides: 'SL_box',
slideDuration:5000,
effectDuration:500,
//effect:Fx.Transitions.Expo.easeInOut,
page:1,
effect:'linear',
fadeDist:700,
fadePosition:'carousel',
stopSlideOnClick: true,
autoSlide: false,
circle:true,//是否首尾相连
nextBtn:'next',//next id
prevBtn:'prev',//prev id
navBuild:'<a href="#" title="Click to navigate" class=""></a>',//是否自动创建dot,false为不创建
navigationNums: true,//是否显示数字索引
navbox:'SL_nav',//数字导航容器
nav:'a',//数字导航元素
onStart:function(D,E){
//$('Slin').fade(.7);
//$.spAni && D.find('.animate').each(function(i,item){
//$(item).removeClass('bounceInLeft')
//});
},
onFinish:function(D,E){
//$('Slin').fade('in');
//D.find('.animate').addClass('bounceInLeft');
$('#output').html(D.attr('id')+'显示'+E.attr('id')+'隐藏');
}
});
Sl2 = new ZUI.SL('SL2',{
moveBox:'SLin2',
slides:'SL_box',
slideDuration:5000,
effectDuration:500,
fadeDist:600,
fadePosition:'fade',
stopSlideOnClick: false,
autoSlide: false,
navigationNums: true, // if true, numbers will appear
navbox:'SL_nav2',
onStart:function(){
//alert('begin')
},
onFinish:function(){
//alert('finish')
}
});
Sl3 = new ZUI.SL('SL3',{
moveBox:'SLin3',
slides:'SL_box2',
slideDuration:5000,
effectDuration:500,
fadeDist:null,
fadePosition:'left',
stopSlideOnClick: false,
autoSlide: false,
navigationNums: true, // if true, numbers will appear
navbox:'SL_nav3',
circle:false,
autoSize:true,
onStart:function(){
//alert('begin')
},
onFinish:function(){
//alert('finish')
}
});
$(function(){
$('#CgSL').on('click',function(){
$('#S4').remove();
//$('SL').append('<div class="SL_box">888888</div>')
Sl.prepareSlides(0);
});
});
//window.shake()
</script>
</body>
</html>