-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo-Switchable-1.html
280 lines (263 loc) · 9.59 KB
/
demo-Switchable-1.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Switchable</title>
<link href="http://libs.useso.com/js/bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet">
<script src="http://libs.useso.com/js/jquery/1.11.1/jquery.min.js"></script>
<script src="dist/js/H.min.js"></script>
<style>
*{
box-sizing: content-box;
font-family: 微软雅黑;
}
.ui-switchable-pannel-wrap{
width: 383px;
height: 483px;
overflow: hidden;
position: relative;
}
.ui-switchable-pannel-list{
margin: 0;
padding: 0;
list-style: none;
position: absolute;
}
.ui-switchable-pannel-list .item{
width: 383px;
height: 483px;
float: left;
}
.ui-switchable-pannel-list .item img{
width: 383px;
height: 483px;
float: left;
}
.ui-switchable-footer{
position: relative;
width: 383px;
height: 79px;
margin-right: 1px;
overflow: hidden;
}
.ui-switchable-trigger-wrap{
float: left;
width: 325px;
height: 79px;
overflow: hidden;
position: relative;
}
.ui-switchable-trigger-list{
margin: 0;
padding: 0;
list-style: none;
position: absolute;
}
.ui-switchable-trigger-list .item{
width: 57px;
height: 73px;
padding: 4px;
float: left;
cursor: pointer;
overflow: hidden;
list-style: none;
position: relative;
}
.ui-switchable-trigger-list .item img{
position: absolute;
z-index: 10;
vertical-align: bottom;
width: 57px;
height: 73px;
}
.ui-switchable-trigger-list .item .ui-slider-shadow{
width: 57px;
height: 73px;
position: absolute;
opacity: 0.1;
z-index: 20;
}
.ui-switchable-trigger-list .active .ui-slider-shadow{
background: 0 0;
opacity: 1;
width: 55px;
height: 71px;
border: 1px solid #f43499;
}
.ui-switchable-btn{
float: left;
width: 29px;
height: 79px;
cursor: pointer;
text-align: center;
}
.ui-switchable-btn .arrow-in, .ui-switchable-btn .arrow-out{
display: inline-block;
font-size: 0;
width: 0;
height: 0;
}
.ui-switchable-btn .arrow-out{
position: relative;
border-width: 10px 10px 10px 0;
border-color: transparent #999 transparent transparent;
border-style: solid;
_border-style: dotted solid dotted dotted;
margin-top: 30px;
}
.ui-switchable-prev .arrow-out{
border-color: transparent #ccc transparent transparent;
}
.ui-switchable-next .arrow-out{
border-width: 10px 0 10px 10px;
border-color: transparent transparent transparent #999;
border-style: solid;
}
.ui-switchable-btn .arrow-in{
position: absolute;
right: -10px;
top: -5px;
_top: -6px;
border-width: 5px 5px 5px 0;
border-color: transparent #fcfafd transparent transparent;
border-style: solid;
}
.ui-switchable-next .arrow-in{
left: -10px;
border-width: 5px 0 5px 5px;
border-color: transparent transparent transparent #fcfafd;
border-style: solid;
_border-style: dotted dotted dotted solid;
}
.list-wrap{
position: relative;
width: 660px;
height: 80px;
overflow: hidden;
}
.list{
position: absolute;
margin: 0;
padding: 0;
list-style: none;
}
.list li{
width: 100px;
height: 80px;
padding: 0 5px;
float: left;
}
.list li img{
width: 100px;
height: 80px;
}
</style>
</head>
<body>
<div class="container">
<h2>Switchable</h2>
<ul>
<li>使用方法请看源代码及注释</li>
</ul>
<div style="height: 50px"></div>
<h2>Demo</h2>
<div class="ui-switchable-pannel-wrap">
<ul id="J-panel-list" class="ui-switchable-pannel-list">
<li class="item"><img src="https://unsplash.it/g/400/500?image=0"></li>
<li class="item"><img src="https://unsplash.it/g/400/500?image=1"></li>
<li class="item"><img src="https://unsplash.it/g/400/500?image=2"></li>
<li class="item"><img src="https://unsplash.it/g/400/500?image=3"></li>
<li class="item"><img src="https://unsplash.it/g/400/500?image=4"></li>
<li class="item"><img src="https://unsplash.it/g/400/500?image=5"></li>
<li class="item"><img src="https://unsplash.it/g/400/500?image=6"></li>
<li class="item"><img src="https://unsplash.it/g/400/500?image=7"></li>
</ul>
</div>
<div class="ui-switchable-footer" id="J-sImgSlide-wrap">
<span class="ui-switchable-btn ui-switchable-prev" id="J-btn-prev">
<em class="arrow-out"><em class="arrow-in"></em></em>
</span>
<div class="ui-switchable-trigger-wrap">
<ul id="J-trigger-list" class="ui-switchable-trigger-list">
<!-- 添加 active 表示当前状态 -->
<li class="item active">
<img src="https://unsplash.it/g/400/500?image=0">
<span class="ui-slider-shadow"></span>
</li>
<li class="item">
<img src="https://unsplash.it/g/400/500?image=1">
<span class="ui-slider-shadow"></span>
</li>
<li class="item">
<img src="https://unsplash.it/g/400/500?image=2">
<span class="ui-slider-shadow"></span>
</li>
<li class="item">
<img src="https://unsplash.it/g/400/500?image=3">
<span class="ui-slider-shadow"></span>
</li>
<li class="item">
<img src="https://unsplash.it/g/400/500?image=4">
<span class="ui-slider-shadow"></span>
</li>
<li class="item">
<img src="https://unsplash.it/g/400/500?image=5">
<span class="ui-slider-shadow"></span>
</li>
<li class="item">
<img src="https://unsplash.it/g/400/500?image=6">
<span class="ui-slider-shadow"></span>
</li>
<li class="item">
<img src="https://unsplash.it/g/400/500?image=7">
<span class="ui-slider-shadow"></span>
</li>
</ul>
</div>
<span class="ui-switchable-btn ui-switchable-next" id="J-btn-next">
<em class="arrow-out"><em class="arrow-in"></em></em>
</span>
</div>
<br><br><br><br><br>
<p>虽然这是个老掉牙的效果,但这样用也是可以的~</p>
<div class="list-wrap">
<ul id="J-panel-list-b" class="list">
<li><img src="https://unsplash.it/g/400/500?image=0"></li>
<li><img src="https://unsplash.it/g/400/500?image=1"></li>
<li><img src="https://unsplash.it/g/400/500?image=2"></li>
<li><img src="https://unsplash.it/g/400/500?image=3"></li>
<li><img src="https://unsplash.it/g/400/500?image=4"></li>
<li><img src="https://unsplash.it/g/400/500?image=5"></li>
<li><img src="https://unsplash.it/g/400/500?image=6"></li>
<li><img src="https://unsplash.it/g/400/500?image=7"></li>
</ul>
</div>
<br><br><br><br><br>
</div>
<script type="text/javascript">
/*
* switchable对样式和DOM结构有很强的依赖性
* 所以使用前一般需要联系我调整样式,或者直接拿demo样式作修改
* */
var switchable = new H.Switchable({
effect: 'fadeX',
panelDom: $('#J-panel-list'),//滚动列表(必传)
triggerDom: $('#J-trigger-list'),//事件触发列表
triggerDomEvent: 'mouseover',//事件触发列表 轮播切换触发方式(可缺省,默认值:click)
prevDom: $('#J-btn-prev'),//上一张按钮(没有的话可缺省)
nextDom: $('#J-btn-next'),//下一张按钮(没有的话可缺省)
trigger: 'click',//轮播切换触发方式(可缺省,默认值:click)
activeCls: 'active',//事件触发列表,表示当前项的css class(可缺省,默认值:active)
interval: 2000,//滚动间隔(可缺省,默认值:3000,单位:毫秒)
scrollTriggerDom: true//事件触发列表滚动开关(此demo中就用到,图片下方的小图区需要滚动,可缺省,默认值:false)
});
switchable.init();
var _switchable = new H.Switchable({
effect: 'slideX',
panelDom: $('#J-panel-list-b'),//滚动列表(必传)
interval: 2000//滚动间隔(可缺省,默认值:3000,单位:毫秒)
});
_switchable.init();
</script>
</body>
</html>