This commit is contained in:
parent
d20952d2fb
commit
5378fffa0a
6 changed files with 66 additions and 24 deletions
|
|
@ -22,11 +22,19 @@ body[data-template="index"] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.projects-index summary {
|
.projects-index {
|
||||||
cursor: pointer;
|
li {
|
||||||
}
|
&.filtered-out {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.projects-index li.filtered-out {
|
section.toggle {
|
||||||
display: none;
|
.project-slideshow {
|
||||||
|
picture:not(.active) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -610,12 +610,12 @@ body[data-template=index] .filter-menu ul {
|
||||||
-moz-column-gap: calc(2 * var(--body-margin));
|
-moz-column-gap: calc(2 * var(--body-margin));
|
||||||
column-gap: calc(2 * var(--body-margin));
|
column-gap: calc(2 * var(--body-margin));
|
||||||
}
|
}
|
||||||
body[data-template=index] .projects-index summary {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
body[data-template=index] .projects-index li.filtered-out {
|
body[data-template=index] .projects-index li.filtered-out {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
body[data-template=index] .projects-index li section.toggle .project-slideshow picture:not(.active) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 1000px) {
|
@media screen and (max-width: 1000px) {
|
||||||
:root {
|
:root {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,32 @@
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
const prevButtons = document.querySelectorAll("button.prev");
|
||||||
|
const nextButtons = document.querySelectorAll("button.next");
|
||||||
|
|
||||||
|
nextButtons.forEach((nextButton) => {
|
||||||
|
nextButton.addEventListener("click", () => {
|
||||||
|
const activePicture = nextButton.closest(".project-slideshow").querySelector("picture.active");
|
||||||
|
const targetPicture =
|
||||||
|
activePicture.nextElementSibling &&
|
||||||
|
activePicture.nextElementSibling.tagName === "PICTURE"
|
||||||
|
? activePicture.nextElementSibling
|
||||||
|
: nextButton.closest(".project-slideshow").querySelector("picture");
|
||||||
|
activePicture.classList.remove("active");
|
||||||
|
targetPicture.classList.add("active");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
prevButtons.forEach((prevButton) => {
|
||||||
|
prevButton.addEventListener("click", () => {
|
||||||
|
const slideshow = prevButton.closest(".project-slideshow");
|
||||||
|
const activePicture = slideshow.querySelector("picture.active");
|
||||||
|
const pictures = [...slideshow.querySelectorAll("picture")];
|
||||||
|
const targetPicture =
|
||||||
|
activePicture.previousElementSibling &&
|
||||||
|
activePicture.previousElementSibling.tagName === "PICTURE"
|
||||||
|
? activePicture.previousElementSibling
|
||||||
|
: pictures[pictures.length - 1];
|
||||||
|
activePicture.classList.remove("active");
|
||||||
|
targetPicture.classList.add("active");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -16,30 +16,32 @@ function selectProject(slug) {
|
||||||
}
|
}
|
||||||
|
|
||||||
allProjects.forEach((project) => {
|
allProjects.forEach((project) => {
|
||||||
project.addEventListener("click", () => {
|
project.querySelector("button").addEventListener("click", () => {
|
||||||
allProjects.forEach((p) => {
|
allProjects.forEach((p) => {
|
||||||
p.classList.add("unselected");
|
p.classList.add("unselected");
|
||||||
p.classList.remove("selected");
|
p.classList.remove("selected");
|
||||||
});
|
});
|
||||||
|
|
||||||
project.classList.add("selected");
|
project.classList.add("selected");
|
||||||
project.classList.remove("unselected");
|
project.classList.remove("unselected");
|
||||||
|
|
||||||
Router.setParam("project", project.dataset.slug);
|
Router.setParam("project", project.dataset.slug);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const toggleProjects = document.querySelectorAll(".project-toggler");
|
// const toggleProjects = document.querySelectorAll(".project-toggler");
|
||||||
|
|
||||||
toggleProjects.forEach((button) => {
|
// toggleProjects.forEach((button) => {
|
||||||
button.addEventListener("click", (event) => {
|
// button.addEventListener("click", (event) => {
|
||||||
const parentLi = button.closest("li");
|
// const parentLi = button.closest("li");
|
||||||
if (parentLi.classList.contains("selected")) {
|
// if (parentLi.classList.contains("selected")) {
|
||||||
event.stopPropagation();
|
// event.stopPropagation();
|
||||||
allProjects.forEach((p) => p.classList.remove("unselected"));
|
// allProjects.forEach((p) => p.classList.remove("unselected"));
|
||||||
parentLi.classList.remove("selected");
|
// parentLi.classList.remove("selected");
|
||||||
Router.setParam("project", null);
|
// Router.setParam("project", null);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
const closeAllProjects = document.querySelectorAll(".all-projects-closer");
|
const closeAllProjects = document.querySelectorAll(".all-projects-closer");
|
||||||
closeAllProjects.forEach((closeProject) => {
|
closeAllProjects.forEach((closeProject) => {
|
||||||
|
|
@ -49,7 +51,7 @@ closeAllProjects.forEach((closeProject) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("routechange", () =>
|
window.addEventListener("routechange", () =>
|
||||||
selectProject(Router.getParam("project")),
|
selectProject(Router.getParam("project"))
|
||||||
);
|
);
|
||||||
|
|
||||||
selectProject(Router.getParam("project"));
|
selectProject(Router.getParam("project"));
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<span> <?= $project->tags() ?> </span>
|
<span> <?= $project->tags() ?> </span>
|
||||||
<span class="date"> <?= $project->date()->toDate('Y') ?> </span>
|
<span class="date"> <?= $project->date()->toDate('Y') ?> </span>
|
||||||
</button>
|
</button>
|
||||||
<span class="slide-number">slide number/total slides</span>
|
<span class="slide-number"><span class="active-index">0</span>/<?= $project->images()->count() ?></span>
|
||||||
</div>
|
</div>
|
||||||
<section class="toggle">
|
<section class="toggle">
|
||||||
<div class= "project-slideshow-container">
|
<div class= "project-slideshow-container">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue