-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.js
22 lines (22 loc) · 776 Bytes
/
1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
document.addEventListener("DOMContentLoaded", function () {
var nut = document.querySelectorAll('.menu ul li');
// console.log(nut);
var noidung = document.querySelectorAll('.thongtinchitiet ul li');
// console.log(noidung);
for (var i = 0; i < nut.length; i++) {
nut[i].addEventListener('click', function(){
for (var i = 0; i < nut.length; i++) {
nut[i].classList.remove('active');
noidung[i].classList.remove('active1');
noidung[i].classList.remove('chuyendong');
}
this.classList.add('active');
var noidungdangchon = this;
var k = 0;
for (k = 0; noidungdangchon = noidungdangchon.previousElementSibling; k++) {}
noidung[k].classList.add('active1');
noidung[k].classList.add('chuyendong');
})
}
// body...
}, false)