-
Notifications
You must be signed in to change notification settings - Fork 0
/
7.html
66 lines (66 loc) · 1.21 KB
/
7.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Training</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
/*$(document).ready(function(){
$("li").eq(0).click(function() {
$(".box").eq(0).toggle();
});
$("li").eq(1).click(function() {
$(".box").eq(1).toggle();
});
$("li").eq(2).click(function() {
$(".box").eq(2).toggle();
});
});*/
$(document).ready(function(){
$("li").each(function(i) {
$(this).click(function() {
$(".box").eq(i).toggle();
});
});
});
</script>
<style>
* {
margin: 0;
padding: 0;
}
.tab-list li {
display: inline-block;
cursor: pointer;
border: 1px solid #ccc;
margin-right: 5px;
padding: 5px 10px;
}
.tab-content {
border: 3px solid #eee;
height: 200px;
margin-top: 5px;
padding: 10px;
width: 600px;
}
.box {
display: none;
}
</style>
</head>
<body>
<ul class="tab-list">
<li>Tab 01</li>
<li>Tab 02</li>
<li>Tab 03</li>
</ul>
<div class="tab-content">
<div class="box">Lorem ipsum dolor sit amet, consectetur adipiscing
elit.</div>
<div class="box">Sed porttitor turpis risus, vitae sodales neque
vulputate ut.</div>
<div class="box">In suscipit nec velit sit amet convallis.
Integer.</div>
</div>
</body>
</html>