-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
54 lines (45 loc) · 1.4 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const bar = document.getElementById("bar");
const close = document.getElementById("close");
const nav = document.getElementById("navbar");
// Mobil Navbar Menu open-close
if (bar) {
bar.addEventListener("click", () => {
nav.classList.add("active");
});
}
if (close) {
close.addEventListener("click", () => {
nav.classList.remove("active");
});
}
// Single Page- change to images
const mainImage = document.getElementById("MainImage");
const smallImage = document.getElementsByClassName("small-img");
function click1() {
mainImage.src = smallImage[0].src;
smallImage[0].classList.add("focus");
smallImage[1].classList.remove("focus");
smallImage[2].classList.remove("focus");
smallImage[3].classList.remove("focus");
}
function click2() {
mainImage.src = smallImage[1].src;
smallImage[1].classList.add("focus");
smallImage[0].classList.remove("focus");
smallImage[2].classList.remove("focus");
smallImage[3].classList.remove("focus");
}
function click3() {
mainImage.src = smallImage[2].src;
smallImage[2].classList.add("focus");
smallImage[1].classList.remove("focus");
smallImage[0].classList.remove("focus");
smallImage[3].classList.remove("focus");
}
function click4() {
mainImage.src = smallImage[3].src;
smallImage[3].classList.add("focus");
smallImage[1].classList.remove("focus");
smallImage[2].classList.remove("focus");
smallImage[0].classList.remove("focus");
}