-
Notifications
You must be signed in to change notification settings - Fork 126
/
index-switch.html
234 lines (231 loc) · 7.96 KB
/
index-switch.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1, user-scalable=0" charset="UTF-8">
<title>swipeSlide</title>
<style>
*{
margin: 0;
padding: 0;
/* 防止点击闪烁 */
-webkit-tap-highlight-color:rgba(0,0,0,0);
/* 缩放网页,文字大小不变 */
-webkit-text-size-adjust:none;
}
body{
font-size: 14px;
}
h1{
font-size: 16px;
}
h2{
font-size: 14px;
}
.slide{
position: relative;
max-width: 640px;
overflow: hidden;
margin: 20px auto;
}
.slide:after{
content: '';
display: block;
width: 100%;
padding-top: 50%;
}
.slide ul{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.slide li{
list-style: none;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.slide_tab{
max-width: 640px;
margin: 20px auto;
border-bottom: 1px solid #ccc;
}
.slide_tab .tab_box{
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
height: 44px;
line-height: 44px;
background-color: #aaa;
text-align: center;
color: #fff;
}
.slide_tab .btn_left,.slide_tab .btn_right{
width: 50px;
}
.slide_tab .tab{
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
.slide_tab .tab span{
display: block;
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
.slide_tab .tab .cur{
background-color: #fff;
color: #333;
}
.slide_tab .product_box{
position: relative;
overflow: hidden;
margin: 0;
border-left: 1px solid #ccc;
}
.slide_tab .product_box:after{
padding-top: 100%;
}
.slide_tab .product_box li:after{
content:'';
display:table;
clear:both;
}
.slide_tab .product_box .pic{
position: relative;
float: left;
width: 50%;
box-sizing: border-box;
border-right: 1px solid #ccc;
border-top: 1px solid #ccc;
}
.slide_tab .product_box .pic:after{
content: '';
display: block;
width: 100%;
padding-top: 100%;
}
.slide_tab .product_box .pic img{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<h1><a href="http://ons.me/" target="_blank" title="一个热爱网络的年轻人的博客">西门的后花园</a></h1>
<h2><a href="http://ons.me/500.html" target="_blank">swipeSlide for Zepto/jQuery Plugin,移动端(基于Zepto/jQuery)的轮播插件</a></h2>
<div class="slide_tab">
<div class="tab_box">
<span class="btn_left">左</span>
<div class="tab">
<span class="item">1</span>
<span class="item">2</span>
<span class="item">3</span>
<span class="item">4</span>
</div>
<span class="btn_right">右</span>
</div>
<div class="product_box slide">
<ul>
<li>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d8.yihaodianimg.com/V00/M0A/75/FD/CgQDslQ3umKAIwpLAAOJQbKq0pg46901_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d8.yihaodianimg.com/V00/M0A/75/FD/CgQDslQ3umKAIwpLAAOJQbKq0pg46901_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d8.yihaodianimg.com/V00/M0A/75/FD/CgQDslQ3umKAIwpLAAOJQbKq0pg46901_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d8.yihaodianimg.com/V00/M0A/75/FD/CgQDslQ3umKAIwpLAAOJQbKq0pg46901_300x300.jpg" alt="">
</a>
</li>
<li>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d9.yihaodianimg.com/N05/M00/24/DF/CgQI0lQ3umiAYat_AAMa5tG_TXY20001_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d9.yihaodianimg.com/N05/M00/24/DF/CgQI0lQ3umiAYat_AAMa5tG_TXY20001_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d9.yihaodianimg.com/N05/M00/24/DF/CgQI0lQ3umiAYat_AAMa5tG_TXY20001_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d9.yihaodianimg.com/N05/M00/24/DF/CgQI0lQ3umiAYat_AAMa5tG_TXY20001_300x300.jpg" alt="">
</a>
</li>
<li>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d6.yihaodianimg.com/N05/M02/24/DF/CgQI0lQ3um2AEZpbAANwKuHIjlw93501_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d6.yihaodianimg.com/N05/M02/24/DF/CgQI0lQ3um2AEZpbAANwKuHIjlw93501_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d6.yihaodianimg.com/N05/M02/24/DF/CgQI0lQ3um2AEZpbAANwKuHIjlw93501_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d6.yihaodianimg.com/N05/M02/24/DF/CgQI0lQ3um2AEZpbAANwKuHIjlw93501_300x300.jpg" alt="">
</a>
</li>
<li>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d7.yihaodianimg.com/V00/M03/75/FD/CgQDslQ3unuAdCOKAAGQmS56iC058101_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d7.yihaodianimg.com/V00/M03/75/FD/CgQDslQ3unuAdCOKAAGQmS56iC058101_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d7.yihaodianimg.com/V00/M03/75/FD/CgQDslQ3unuAdCOKAAGQmS56iC058101_300x300.jpg" alt="">
</a>
<a href="#" class="pic">
<img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="http://d7.yihaodianimg.com/V00/M03/75/FD/CgQDslQ3unuAdCOKAAGQmS56iC058101_300x300.jpg" alt="">
</a>
</li>
</ul>
</div>
</div>
<script src="js/zepto.min.js"></script>
<!-- <script src="js/jquery.min.js"></script> -->
<script src="js/swipeSlide.min.js"></script>
<script>
$(function(){
var slideTab = $('.slide_tab .slide').swipeSlide({
continuousScroll:true,
autoSwipe : false,
lazyLoad : true,
firstCallback : function(i){
$('.slide_tab .tab .item').eq(i).addClass('cur');
},
callback : function(i){
$('.slide_tab .tab .item').eq(i).addClass('cur').siblings().removeClass('cur');
}
});
$('.slide_tab .tab .item').on('click',function(i){
slideTab[0].goTo($(this).index());
});
$('.slide_tab .btn_left').on('click',function(i){
slideTab[0].goTo('prev');
});
$('.slide_tab .btn_right').on('click',function(i){
slideTab[0].goTo('next');
});
});
</script>
</body>
</html>