Home > slideshow > videos verticales incluses dans paires
All checks were successful
Deploy / Deploy to Production (push) Successful in 8s
All checks were successful
Deploy / Deploy to Production (push) Successful in 8s
This commit is contained in:
parent
4412a0a01a
commit
3486ae9c6c
10 changed files with 85 additions and 43 deletions
|
|
@ -24,7 +24,8 @@
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
&.portrait-pair > picture {
|
||||
&.portrait-pair > picture,
|
||||
&.portrait-pair > video {
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
}
|
||||
|
|
@ -37,19 +38,17 @@
|
|||
object-fit: cover;
|
||||
}
|
||||
|
||||
button{
|
||||
button {
|
||||
position: absolute;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
&.prev{
|
||||
&.prev {
|
||||
left: 0;
|
||||
cursor: w-resize;
|
||||
}
|
||||
&.next{
|
||||
&.next {
|
||||
right: 0;
|
||||
cursor: e-resize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ button#mobile-menu-toggle {
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#home-slideshow .slide.portrait-pair > picture {
|
||||
#home-slideshow .slide.portrait-pair > picture, #home-slideshow .slide.portrait-pair > video {
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -26,15 +26,34 @@ if (slideshow) {
|
|||
return index;
|
||||
}
|
||||
|
||||
function updateVideos(index) {
|
||||
const el = items[index];
|
||||
const videos = el.querySelectorAll("video");
|
||||
videos.forEach((video) => {
|
||||
video.currentTime = 0;
|
||||
video.play().catch(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
function pauseAllVideos() {
|
||||
items.forEach((el) => {
|
||||
const videos = el.querySelectorAll("video");
|
||||
videos.forEach((video) => video.pause());
|
||||
});
|
||||
}
|
||||
|
||||
function goTo(index) {
|
||||
items[current].classList.remove("active");
|
||||
pauseAllVideos();
|
||||
current = index;
|
||||
items[current].classList.add("active");
|
||||
updateVideos(current);
|
||||
}
|
||||
|
||||
const firstVisible = findNext(-1, 1);
|
||||
items[firstVisible]?.classList.add("active");
|
||||
current = firstVisible;
|
||||
updateVideos(current);
|
||||
|
||||
prev?.addEventListener("click", () => goTo(findNext(current, -1)));
|
||||
next?.addEventListener("click", () => goTo(findNext(current, 1)));
|
||||
|
|
@ -45,4 +64,4 @@ if (slideshow) {
|
|||
goTo(findNext(current, 1));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue