-
Notifications
You must be signed in to change notification settings - Fork 0
/
etudiant.js
27 lines (26 loc) · 973 Bytes
/
etudiant.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
const onglets = document.querySelectorAll(".onglets");
const contenu = document.querySelectorAll(".contenu");
let index = 0;
onglets.forEach((onglet) => {
onglet.addEventListener("focus", () => {
if (onglet.classList.contains('active')) {
return;
} else {
onglet.classList.add('active');
}
index = onglet.getAttribute('data-anim');
console.log(index);
for (i = 0; i < onglets.length; i++) {
if (onglets[i].getAttribute('data-anim') != index) {
onglets[i].classList.remove('active');
}
}
for(j=0;j<contenu.length;j++){
if(contenu[j].getAttribute('data-anim')==index){
contenu[j].classList.add('activeContenu');
}else{
contenu[j].classList.remove('activeContenu');
}
}
});
});