-
Notifications
You must be signed in to change notification settings - Fork 6
/
demo.html
108 lines (100 loc) · 2.19 KB
/
demo.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Tabbis</title>
<style>
* {
padding: 0;
margin: 0;
font-family: arial;
}
body {
padding: 0 40px;
}
h2 {
margin: 20px 0;
}
[data-tabs] {
display: flex;
background: #eee;
padding: 10px;
border: 2px solid #ccc;
}
[data-tabs] > * {
padding: 5px 20px;
cursor: pointer;
}
[data-tabs] .active {
background: #31a3e8;
color: #fff;
border-radius: 5px;
}
[data-panes] > * {
display: none;
border: 2px solid #ccc;
border-top: none;
padding: 20px;
}
[data-panes] > .active {
display: block;
}
</style>
</head>
<body>
<h2>Flat</h2>
<div data-tabs>
<div class="active">Tab1</div>
<div>Tab2</div>
<div>Tab3</div>
</div>
<div data-panes>
<div class="active">Pane1</div>
<div>Pane2</div>
<div>Pane3</div>
</div>
<h2>Nested</h2>
<div data-tabs>
<div class="active">Tab1</div>
<div>Tab2</div>
<div>Tab3</div>
</div>
<div data-panes>
<div class="active">Pane1</div>
<div>
<div data-tabs>
<div class="active">Tab4</div>
<div>Tab5</div>
</div>
<div data-panes>
<div class="active">Pane4</div>
<div>
<div data-tabs>
<div class="active">Tab6</div>
<div>Tab7</div>
</div>
<div data-panes>
<div class="active">Pane6</div>
<div>Pane7</div>
</div>
</div>
</div>
</div>
<div>Pane3</div>
</div>
<script src="tabbis.js"></script>
<script>
var tabs = tabbis.init({
tabGroup: "[data-tabs]",
paneGroup: "[data-panes]",
tabActive: "active",
paneActive: "active",
callback: function(tab, pane) {
console.log(tab);
console.log(pane);
}
});
</script>
</body>
</html>