-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
28 lines (27 loc) · 848 Bytes
/
script.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
let productImg = document.getElementById("productImg");
let productImg2 = document.getElementById("productImg2");
let btn = document.getElementsByClassName("btn");
btn[0].onclick = function () {
productImg.src = "images/image1.png";
productImg2.src = "images/image1.png";
for (bt of btn) {
bt.classList.remove("active");
}
this.classList.add("active");
}
btn[1].onclick = function () {
productImg.src = "images/image2.png";
productImg2.src = "images/image2.png";
for (bt of btn) {
bt.classList.remove("active");
}
this.classList.add("active");
}
btn[2].onclick = function () {
productImg.src = "images/image3.png";
productImg2.src = "images/image3.png";
for (bt of btn) {
bt.classList.remove("active");
}
this.classList.add("active");
}