-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
75 lines (58 loc) · 1.9 KB
/
script.js
File metadata and controls
75 lines (58 loc) · 1.9 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
var slideIndex = 1;
function moveSlider(direction) {
showImg(slideIndex += direction);
};
function showImg(index) {
const slider = document.querySelectorAll(".slider");
if (index > slider.length) {
slideIndex = 1;
}
if (index < 1) {
slideIndex = slider.length;
}
for (let i = 0; i < slider.length; i++) {
if (i === slideIndex - 1) {
slider[slideIndex-1].style.display = "block";
} else {
slider[i].style.display = "none";
}
}
};
showImg(slideIndex);
const search = document.querySelector(".search");
const searchIcon = document.querySelector(".search-open");
const closeIcon = document.querySelector(".search-close");
searchIcon.onclick = () => {
search.classList.add("open");
};
closeIcon.onclick = () => {
search.classList.remove("open");
};
const gradient = document.querySelector(".gradient");
const loadMore = document.querySelector(".load-button");
const projectSection = document.querySelector(".projects");
loadMore.onclick = () => {
if (loadMore.classList.contains("loaded")) {
loadMore.classList.remove("loaded");
document.querySelector(".load-button div").innerHTML = "Rozwiń";
projectSection.style.paddingBottom = "2px";
gradient.style.height = "55%"
loadMore.style.bottom = "90px"
} else {
loadMore.classList.add("loaded");
document.querySelector(".load-button div").innerHTML = "Zwiń";
projectSection.style.paddingBottom = "90px";
gradient.style.height = "0px"
loadMore.style.bottom = "44px"
}
};
const popup = document.querySelector(".popup");
function closePopup() {
popup.style.display = "none";
}
document.querySelectorAll(".photo").forEach(image => {
image.onclick = () => {
popup.style.display = "block";
document.querySelector(".popup-photo").src = image.getAttribute('src');
}
})