{})" - @mouseleave="hovering = false; if ($refs.video) { $refs.video.pause(); $refs.video.currentTime = 0; }" + x-data="{ + hovering: false, + get isActive() { + return this.hovering || ($store.audio.isPlaying && $store.audio.currentTrack?.url === '{{ $audio }}'); + } + }" + :class="isActive ? '' : 'grayscale'" + @mouseenter="hovering = true" + @mouseleave="hovering = false" > {{/* Cover Image/Video */}} @@ -15,7 +24,7 @@ src="{{ $img.RelPermalink }}" alt="{{ $.Title }}" class="track-card__cover w-full h-full object-cover" - :class="{ 'opacity-0': hovering && $refs.video }" + :class="{ 'opacity-0': isActive && $refs.video }" loading="lazy" decoding="async" > @@ -27,24 +36,25 @@ {{- end }} - {{/* Video preview on hover */}} + {{/* Video preview on hover or playing */}} {{- with .Resources.GetMatch "preview.*" }} {{- end }} {{/* Play overlay - only show if NO video exists */}} {{- if not $hasVideo }} - - + + diff --git a/layouts/tracks/single.html b/layouts/tracks/single.html index 950fd72..4f93b88 100755 --- a/layouts/tracks/single.html +++ b/layouts/tracks/single.html @@ -35,35 +35,48 @@ {{- $img := .Resize "400x webp q90" }} - {{/* Video preview on hover */}} + {{/* Video preview on hover or playing */}} {{- with $.Resources.GetMatch "preview.*" }} {{- end }} @@ -74,13 +87,17 @@