-
Notifications
You must be signed in to change notification settings - Fork 5
/
03tab切换和进度条效果.html
159 lines (135 loc) · 2.99 KB
/
03tab切换和进度条效果.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
<!DOCTYPE html>
<html lang="zh-CH">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>面试题</title>
<style>
* {
margin: 0;
padding: 0;
list-style: none;
}
.box {
margin: auto;
width: 500px;
height: 500px;
border: 1px solid #000;
}
.title {
height: 50px;
line-height: 50px;
}
.title ul {
overflow: hidden;
}
.title ul li {
display: block;
float: left;
margin: 0 20px;
/* border-bottom: 2px solid blue; */
}
.character {
border-bottom: 2px solid #87CEFA;
color: #87CEFA;
}
.main {
padding: 20px;
}
.none {
display: none;
}
.block {
display: block;
}
.progress {
/* float: left; */
}
.progress ul {
position: relative;
display: flex;
justify-content: space-around;
}
.progress ul::after {
content: " ";
position: absolute;
top: 100%;
left: 10%;
width: 80%;
height: 5PX;
transform: translateY(60%);
border-bottom: 1px solid #000;
}
.progress ul li {
position: relative;
}
.progress ul li::after {
content: " ";
display: block;
top: 100%;
left: 50%;
position: absolute;
width: 6px;
height: 6px;
background-color: blue;
border: 1px solid blue;
border-radius: 6px;
transform: translate(-50%, 60%);
}
.triangle ul>li::after {
width: 0;
height: 0;
border: 7px solid;
border-radius: 0;
background-color: #fff;
border-color: transparent transparent blue;
transform: translate(-45%, -11%);
}
.triangle ul>li:nth-child(even) {
transform: translateY(180%);
}
.triangle ul>li:nth-child(even)::after {
top: -10px;
transform: rotate(180deg) translateX(45%);
}
</style>
</head>
<body>
<div class="box">
<div class="title">
<ul>
<li class="character">进度条</li>
<li>小三角</li>
</ul>
</div>
<div class="main">
<div class="progress">
<ul>
<li>文字标签</li>
<li>文字标签</li>
<li>文字标签</li>
<li>文字标签</li>
<li>文字标签</li>
</ul>
</div>
<div class="progress triangle none">
<ul>
<li>文字标签</li>
<li>文字标签</li>
<li>文字标签</li>
<li>文字标签</li>
<li>文字标签</li>
</ul>
</div>
</div>
</div>
<script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script>
$('.title ul li').click(function () {
$(this).addClass('character').siblings('li').removeClass('character');
var index = $(this).index();
$('.main div').eq(index).addClass('block').siblings().addClass('none').removeClass('block');
})
</script>
</body>
</html>