-
Notifications
You must be signed in to change notification settings - Fork 0
/
手风琴选项卡.html
100 lines (92 loc) · 2.39 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
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
body {
background-color: #fff
}
body .left {
width: 100px;
background-color: #0ff;
float: left
}
body .right {
width: 200px;
height: 200px;
float: left
}
body .right .no1 div,
body .right .no2 div {
width: 200px;
height: 200px;
background-color: #ff0;
display: none
}
body .right .no1 .show,
body .right .no2 .show {
display: block
}
.hide {
display: none
}
</style>
</head>
<body>
<div class="left">
<dl>
<dt class="title">列表1</dt>
<dd class="hide">列表1</dd>
<dd class="hide">列表2</dd>
<dd class="hide">列表3</dd>
</dl>
<dl>
<dt class="title">列表2</dt>
<dd class="hide">列表4</dd>
<dd class="hide">列表5</dd>
<dd class="hide">列表6</dd>
</dl>
<dl>
<dt class="title">列表3</dt>
<dd class="hide">列表7</dd>
<dd class="hide">列表8</dd>
<dd class="hide">列表9</dd>
</dl>
</div>
<div class="right">
<div class="no1">
<div class="show">列表1</div>
<div>列表2</div>
<div>列表3</div>
</div>
<div class="no1">
<div>列表4</div>
<div>列表5</div>
<div>列表6</div>
</div>
<div class="no1">
<div>列表7</div>
<div>列表8</div>
<div>列表9</div>
</div>
</div>
</body>
<script type="text/javascript">
$(function() {
var dlindex;
$("dl").click(function(event) {
dlindex = $(this).index();
});
$("dt").click(function(event) {
$(this).siblings('dd').toggleClass('hide');
$("dl").eq(dlindex).find("dd").addClass('hide')
});
$("dd").click(function(event) {
$(".no1").eq(dlindex).children().eq($(this).index() - 1).addClass('show').siblings().removeClass('show');
$(".no1").eq(dlindex).siblings().children().removeClass('show');
});
})
</script>
</html>