Fix hero video loading with white overlay fade-in
All checks were successful
build-website / build (push) Successful in 1m36s

- Remove poster image to eliminate jarring flash
- Add white gradient overlay that fades when video ready
- Implement smooth 800ms transition for premium UX
- Add video preload link tag for faster loading
- Works seamlessly on both mobile and desktop

The white overlay approach provides a clean loading experience that matches the luxury brand aesthetic while the video loads in the background.
This commit is contained in:
2025-09-19 02:12:04 +02:00
parent b05111b613
commit 9335d14ca4
2 changed files with 21 additions and 12 deletions

View File

@@ -1,6 +1,12 @@
<template> <template>
<section class="hero-voyage" id="heroSection"> <section class="hero-voyage" id="heroSection">
<div ref="videoContainer" class="hero-video-container"> <div ref="videoContainer" class="hero-video-container">
<!-- White overlay that fades out when video is ready -->
<div
class="video-white-overlay"
:class="{ 'fade-out': videoLoaded }"
/>
<video <video
ref="videoElement" ref="videoElement"
autoplay autoplay
@@ -8,7 +14,6 @@
muted muted
playsinline playsinline
preload="auto" preload="auto"
poster="/golden_gate.jpg"
class="hero-video" class="hero-video"
:class="{ 'video-loaded': videoLoaded }" :class="{ 'video-loaded': videoLoaded }"
@loadeddata="handleVideoLoaded" @loadeddata="handleVideoLoaded"
@@ -21,12 +26,6 @@
> >
</video> </video>
<div
class="hero-image-fallback"
:class="{ 'fade-out': videoLoaded }"
:style="{ backgroundImage: 'url(/golden_gate.jpg)' }"
/>
<div class="hero-overlay gradient-warm" /> <div class="hero-overlay gradient-warm" />
<div class="hero-overlay gradient-depth" /> <div class="hero-overlay gradient-depth" />
</div> </div>
@@ -187,12 +186,21 @@ onMounted(() => {
opacity: 1; opacity: 1;
} }
/* Ensure the fallback image fades out smoothly */ /* White overlay for smooth video loading transition */
.hero-image-fallback { .video-white-overlay {
transition: opacity 0.5s ease-in-out; position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
z-index: 2;
opacity: 1;
transition: opacity 800ms ease-out;
will-change: opacity;
} }
.hero-image-fallback.fade-out { .video-white-overlay.fade-out {
opacity: 0; opacity: 0;
pointer-events: none; pointer-events: none;
} }

View File

@@ -124,7 +124,8 @@ export default defineNuxtConfig({
], ],
link: [ link: [
{ rel: 'icon', type: 'image/png', href: '/HARBOR-SMITH-navy.png' }, { rel: 'icon', type: 'image/png', href: '/HARBOR-SMITH-navy.png' },
{ rel: 'apple-touch-icon', href: '/HARBOR-SMITH-navy.png' } { rel: 'apple-touch-icon', href: '/HARBOR-SMITH-navy.png' },
{ rel: 'preload', as: 'video', href: 'https://videos.pexels.com/video-files/3571264/3571264-uhd_2560_1440_30fps.mp4', crossorigin: 'anonymous' }
] ]
}, },
pageTransition: { name: 'page', mode: 'out-in' }, pageTransition: { name: 'page', mode: 'out-in' },