fix: videos and video buttons

This commit is contained in:
Oleksandr 2026-02-17 19:02:00 +02:00
parent f26e76c114
commit 10edd8f19d
Signed by: Xanazf
GPG key ID: 821EEC32761AC17C
2 changed files with 20 additions and 5 deletions

View file

@ -66,6 +66,8 @@ document.addEventListener("DOMContentLoaded", () => {
}; };
const updateDimensions = () => { const updateDimensions = () => {
// capture item width
const oldItemWidth = itemWidth;
itemWidth = container.clientWidth; itemWidth = container.clientWidth;
if (itemWidth === 0) return; if (itemWidth === 0) return;
@ -79,9 +81,15 @@ document.addEventListener("DOMContentLoaded", () => {
item.style.maxWidth = `${itemWidth}px`; item.style.maxWidth = `${itemWidth}px`;
}); });
if (oldItemWidth > 0) {
const scrollRatio = targetScrollX / oldItemWidth;
const relativeScroll = scrollRatio % originalCount;
targetScrollX = targetScrollX =
bufferSize * sequenceWidth + (bufferSize * originalCount + relativeScroll) * itemWidth;
(targetScrollX % sequenceWidth); } else {
targetScrollX = bufferSize * sequenceWidth;
}
currentScrollX = targetScrollX; currentScrollX = targetScrollX;
scroller.style.transform = `translateX(-${currentScrollX}px)`; scroller.style.transform = `translateX(-${currentScrollX}px)`;
}; };

View file

@ -95,7 +95,7 @@
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
width: 100%; width: 100%;
max-width: 85rem; max-width: 80rem;
height: 100%; height: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -127,6 +127,8 @@
opacity: 0.5; opacity: 0.5;
transition: opacity 0.3s ease; transition: opacity 0.3s ease;
backdrop-filter: blur(var(--2xs)); backdrop-filter: blur(var(--2xs));
border-radius: var(--radius-xs);
background-color: #55555580;
} }
&:hover { &:hover {
@ -162,13 +164,18 @@
} }
} }
@media (min-width: 83rem) {
.marquee-scroll {
min-width: 88rem;
max-width: 90rem;
}
}
@media not (min-width: 83rem) { @media not (min-width: 83rem) {
.marquee-scroll-arrow { .marquee-scroll-arrow {
height: unset; height: unset;
& > div { & > div {
background-color: #55555580; background-color: #55555580;
border-radius: var(--radius-xs);
} }
} }
} }