-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
69 lines (56 loc) · 1.76 KB
/
script.js
File metadata and controls
69 lines (56 loc) · 1.76 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
const showMoreBtn = document.getElementById("show-more");
if (showMoreBtn) {
showMoreBtn.addEventListener("click", function () {
const hiddenMovies = document.querySelectorAll(
".movie-item:nth-child(n+7)"
);
const isShowingMore = this.classList.toggle("expanded");
if (isShowingMore) {
hiddenMovies.forEach((item) => item.classList.add("show"));
this.textContent = "Show less";
} else {
hiddenMovies.forEach((item) => item.classList.remove("show"));
this.textContent = "Show more";
}
});
}
document.querySelectorAll(".title-footer").forEach((title) => {
title.addEventListener("click", () => {
title.parentElement.parentElement.classList.toggle("footer-list--open");
});
});
const scrollTopBtn = document.getElementById("scrollTopBtn");
if (scrollTopBtn) {
window.addEventListener("scroll", () => {
if (window.scrollY > 10) {
scrollTopBtn.classList.add("show");
} else {
scrollTopBtn.classList.remove("show");
}
});
scrollTopBtn.addEventListener("click", () => {
window.scrollTo({ top: 0, behavior: "smooth" });
});
}
const movieImages = [
"pictures/movie1.jpeg",
"pictures/BR.bild2.jpg",
"pictures/BR-bild3.jpeg",
];
let movieIndex = 0;
const movieImgElement = document.getElementById("bladeRunnerSlideshow");
if (movieImgElement) {
movieImgElement.src = movieImages[movieIndex];
movieImgElement.style.opacity = 1;
function showMovieImage(newIndex) {
movieImgElement.style.opacity = 0;
setTimeout(() => {
movieIndex = (newIndex + movieImages.length) % movieImages.length;
movieImgElement.src = movieImages[movieIndex];
movieImgElement.style.opacity = 1;
}, 500);
}
setInterval(() => {
showMovieImage(movieIndex + 1);
}, 3000);
}