-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs.js
More file actions
23 lines (19 loc) · 736 Bytes
/
js.js
File metadata and controls
23 lines (19 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const tabs = document.querySelector(".tabs")
const item = tabs.querySelector(".tabpage")
const items = tabs.querySelectorAll(".tabpage")
const list = tabs.querySelector(".tabheaditem")
const lists = tabs.querySelectorAll(".tabheaditem")
item.classList.add("show")
list.classList.add("active")
if (lists.length != items.length) {
alert("The number of tabs does not match the number of pages.")
}
for ( i = lists.length -1 ; ~i!=0 ; i-- ) {
lists[i].setAttribute("onclick", "makemeshow(" + i + ")")
}
function makemeshow (t) {
tabs.querySelector(".show").classList.remove("show");
items[t].classList.add("show")
tabs.querySelector(".active").classList.remove("active");
lists[t].classList.add("active")
}