fix: layout jump on video loading

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

View file

@ -44,18 +44,21 @@ const videos = [
{videos.map(({ author, source, installable, path }, index) => { {videos.map(({ author, source, installable, path }, index) => {
return ( return (
<div class=`marquee-item`> <div class=`marquee-item`>
<div class="marquee-item-spacing marquee-item-content video-wrapper">
<video <video
data-media-index={index} data-media-index={index}
data-media-author={author} data-media-author={author}
id="showcase-video" id="showcase-video"
class="marquee-item-spacing marquee-item-content"
muted muted
controls controls
playsinline playsinline
preload="metadata" preload="metadata"
style="opacity: 0; transition: opacity 0.5s"
onloadeddata="this.style.opacity='1'"
> >
<source src={path} type="video/mp4"/> <source src={path} type="video/mp4"/>
</video> </video>
</div>
<p> <p>
Configuration by <Fragment set:html={author}/> Configuration by <Fragment set:html={author}/>
{source && !installable && <>(<a href={source}>source code</a>)</>} {source && !installable && <>(<a href={source}>source code</a>)</>}

View file

@ -67,16 +67,28 @@
padding-inline: 0.5rem; padding-inline: 0.5rem;
box-sizing: border-box; box-sizing: border-box;
will-change: opacity; will-change: opacity;
width: 100vw;
flex: 0 0 100vw;
& > * { & > * {
z-index: 11; z-index: 11;
} }
& video { & .video-wrapper {
position: relative; position: relative;
width: 100%;
max-width: 75rem; max-width: 75rem;
aspect-ratio: 16 / 9;
box-shadow: var(--shadow-md); box-shadow: var(--shadow-md);
background-color: hsl(var(--bg-700));
overflow: hidden;
& video {
width: 100%;
height: 100%;
object-fit: cover;
}
} }
} }
@ -173,9 +185,5 @@
@media not (min-width: 83rem) { @media not (min-width: 83rem) {
.marquee-scroll-arrow { .marquee-scroll-arrow {
height: unset; height: unset;
& > div {
background-color: #55555580;
}
} }
} }