-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path轮播.html
168 lines (135 loc) · 3.85 KB
/
轮播.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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<style>
ul li {
-webkit-transition: all ease 1s;
-moz-transition: all ease 1s;
-o-transition: all ease 1s;
transition: all ease 1s;
}
.slide {
position: relative;
margin: auto;
width: 600px;
height: 200px;
text-align: center;
font-family: Arial;
color: #FFF;
overflow: hidden;
}
.slide ul {
margin: 10px 0;
padding: 0;
width: 9999px;
transition: all 0.5s;
}
/*//自动播放*/
.slide .slide-auto {
animation: marginLeft 10.5s infinite;
}
.slide li {
float: left;
width: 600px;
height: 200px;
list-style: none;
line-height: 200px;
font-size: 36px;
}
.slide li:nth-child(1) {
background: #9fa8ef;
}
.slide li:nth-child(2) {
background: #ef9fb1;
}
.slide li:nth-child(3) {
background: #9fefc3;
}
.slide input[name="sildeInput"] {
display: none;
}
.slide label[for^="sildeInput"] {
position: absolute;
top: 170px;
width: 20px;
height: 20px;
margin: 0 10px;
line-height: 20px;
color: #FFF;
background: #000;
cursor: pointer;
}
@keyframes marginLeft {
0% {
margin-left: 0;
}
28.5% {
margin-left: 0;
}
33.3% {
margin-left: -600px;
}
62% {
margin-left: -600px;
}
66.7% {
margin-left: -1200px;
}
95.2% {
margin-left: -1200px;
}
100% {
margin-left: 0;
}
}
.slide label[for="sildeInput1"] {
left: 0;
}
.slide label[for="sildeInput2"] {
left: 30px;
}
.slide label[for="sildeInput3"] {
left: 60px;
}
#sildeInput1:checked ~ ul {
margin-left: 0;
}
#sildeInput2:checked ~ ul {
margin-left: -600px;
}
#sildeInput3:checked ~ ul {
margin-left: -1200px;
}
</style>
</head>
<body>
<!-- 自动播放 -->
<div class="slide">
<ul class="slide-auto">
<li>one</li>
<li>two</li>
<li>three</li>
</ul>
</div>
<!-- 点击轮播 -->
<div class="slide">
<input type="radio" name="sildeInput" value="0" id="sildeInput1" checked hidden />
<label for="sildeInput1">1</label>
<input type="radio" name="sildeInput" value="1" id="sildeInput2" hidden />
<label for="sildeInput2">2</label>
<input type="radio" name="sildeInput" value="1" id="sildeInput3" hidden />
<label for="sildeInput3">3</label>
<ul>
<li>one-点击切换</li>
<li>two-点击切换</li>
<li>three-点击切换</li>
</ul>
</div>
</body>
</html>