forked from Fzw-com/animate_demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tab-control.html
168 lines (168 loc) · 4.1 KB
/
tab-control.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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
*{
margin:0;
padding:0;
}
li{
list-style:none;
}
.warp{
width:966px;
padding:8px 4px;
height:332px;
border:1px solid #c6c6c6;
margin:20px auto;
}
.left{
float:left;
background:#C6C7C0;
}
.left li{
border-left:1px solid #c6c6c6;
border-top:1px solid #c6c6c6;
width:145px;
height:82px;
line-height:82px;
text-align:center;
font-size:16px;
}
.li_active{
background:#FFF;
}
#right div{
float:left;
width:812px;
height:330px;
position:relative;
display:none;
}
#right img{
width:812px;
height:330px;
display:none;
}
#right ul{
width:812px;
position: absolute;
color:#000;
top:301px;
}
#right li{
height:30px;
width:33.2%;
float:left;
line-height:30px;
margin-right:1px;
background:#C6C7C0;
opacity:0.6;
text-align:center;
font-size:12px;
color:#000;
}
#right .img_active{
background:#ef3163;
}
#right .flex4 li{
width:24.8%;
}
</style>
</head>
<script type="text/javascript">
window.onload=function(){
var oUl=document.getElementById("left");
var oLi=oUl.getElementsByTagName("li");
var oRight=document.getElementById("right");
var oDiv=oRight.getElementsByTagName("div");
for(var i=0;i<oLi.length;i++){
oLi[i].index=i;
oLi[i].onmouseover=function(){
for(j=0;j<oDiv.length;j++){
oDiv[j].style.display="none";
oLi[j].className='';
}
oDiv[this.index].style.display="block";
this.className="li_active";
}
}
for(var i=0;i<oDiv.length;i++){
tab(oDiv[i]);
}
function tab(obj){
var oImg=obj.getElementsByTagName("img");
var oLi=obj.getElementsByTagName("li");
for(var i=0;i<oLi.length;i++){
oLi[i].index=i;
oLi[i].onmouseover=function(){
for(var j=0;j<oImg.length;j++){
oImg[j].style.display="none";
oLi[j].className='';
}
oImg[this.index].style.display="block";
this.className="img_active";
}
}
}
}
</script>
<body>
<div class="warp">
<ul class="left" id="left">
<li class="li_active">最热团购</li>
<li>商城特惠</li>
<li>名品推荐</li>
<li>缤纷活动</li>
</ul>
<div id="right">
<div style="display: block;">
<img src="img/tab-img/a1.jpg" style="display:block" />
<img src="img/tab-img/a2.jpg" />
<img src="img/tab-img/a3.jpg" />
<ul>
<li class="img_active">第一个第一项</li>
<li>第一个第二项</li>
<li>第一个第三项</li>
</ul>
</div>
<div>
<img src="img/tab-img/b1.jpg" style="display:block" />
<img src="img/tab-img/b2.jpg" />
<img src="img/tab-img/b3.jpg" />
<img src="img/tab-img/b4.jpg" />
<ul class="flex4">
<li class="img_active">第二个第一项</li>
<li>第二个第二项</li>
<li>第二个第三项</li>
<li>第二个第四项</li>
</ul>
</div>
<div>
<img src="img/tab-img/c1.jpg" style="display:block" />
<img src="img/tab-img/c2.jpg" />
<img src="img/tab-img/c3.jpg" />
<ul>
<li class="img_active">第三个第一项</li>
<li>第三个第二项</li>
<li>第三个第三项</li>
</ul>
</div>
<div>
<img src="img/tab-img/d1.jpg" style="display:block"/>
<img src="img/tab-img/d2.jpg" />
<img src="img/tab-img/d3.jpg" />
<img src="img/tab-img/d4.jpg" />
<ul class="flex4">
<li class="img_active">第四个第一项</li>
<li>第四个第二项</li>
<li>第四个第三项</li>
<li>第四个第四项</li>
</ul>
</div>
</div>
</div>
</body>
</html>