-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod1.js
49 lines (39 loc) · 1.42 KB
/
mod1.js
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
let tabHeader = document.querySelectorAll('.tabHeader');
tabHeader.forEach((button) => {
button.onclick = changeTabHeader;
});
function changeTabHeader() {
let tabNumber = parseInt(this.dataset.tab);
document.querySelector('.active-tab').classList.remove('active-tab');
this.classList.add('active-tab');
switch (tabNumber) {
case 1:
changeTabSection(tabNumber);
break;
case 2:
changeTabSection(tabNumber);
break;
case 3:
changeTabSection(tabNumber);
break;
case 4:
changeTabSection(tabNumber);
break;
case 5:
changeTabSection(tabNumber);
break;
case 6:
changeTabSection(tabNumber);
break;
default:
break;
}
}
function changeTabSection(tabNumber) {
let currentTab = document.querySelector('.show-tab');
currentTab.classList.remove('show-tab');
currentTab.classList.add('hide-tab');
let newSection = document.getElementById('tabSection-' + tabNumber);
newSection.classList.remove('hide-tab');
newSection.classList.add('show-tab');
}