clean project-slideshow script
This commit is contained in:
parent
1b108ac44f
commit
4dd4834aeb
3 changed files with 3 additions and 28 deletions
|
|
@ -105,7 +105,7 @@ ul {
|
||||||
}
|
}
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
.filter-menu {
|
&.filter-menu {
|
||||||
display: flex;
|
display: flex;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ ul {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav .filter-menu {
|
nav.filter-menu {
|
||||||
display: flex;
|
display: flex;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -109,7 +109,7 @@ nav .filter-menu {
|
||||||
gap: calc(2 * var(--body-margin));
|
gap: calc(2 * var(--body-margin));
|
||||||
margin: calc(4 * var(--line-height-S)) 0 var(--line-height-S) 0;
|
margin: calc(4 * var(--line-height-S)) 0 var(--line-height-S) 0;
|
||||||
}
|
}
|
||||||
nav .filter-menu a {
|
nav.filter-menu a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
document.querySelectorAll(".project-slideshow").forEach((slideshow) => {
|
|
||||||
function goToNextSlide() {
|
|
||||||
const currentSlide = document.querySelector(".project-images .active");
|
|
||||||
const slideToShow = currentSlide.nextElementSibling
|
|
||||||
? currentSlide.nextElementSibling
|
|
||||||
: document.querySelector(".project-images img");
|
|
||||||
|
|
||||||
currentSlide.classList.toggle("active");
|
|
||||||
slideToShow.classList.toggle("active");
|
|
||||||
}
|
|
||||||
|
|
||||||
const images = slideshow.querySelector(".project-images");
|
|
||||||
const prevButton = slideshow.querySelector(".prev");
|
|
||||||
const nextButton = slideshow.querySelector(".next");
|
|
||||||
|
|
||||||
nextButton.addEventListener("click", () => {
|
|
||||||
goToNextSlide();
|
|
||||||
});
|
|
||||||
|
|
||||||
prevButton.addEventListener("click", () => {
|
|
||||||
currentIndex =
|
|
||||||
(currentIndex - 1 + images.children.length) % images.children.length;
|
|
||||||
goToPrevSlide();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue