fix(story): smooth hero overlay fade-out and add scrolly caption background
Overlay previously hard-hid with display:none when scrollY = 100vh, while the title was still visible (it exits at ~115vh). Now fades in 0→0.65 over the first 70vh then fades back out to 0 by 140vh (full hero height). Scrolly caption changed from full-width to centered pill with rgba(0,0,0,0.45) background — readable against any image regardless of tone. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vgmzx8VTTTmCskSpQtsLTr
This commit is contained in:
@@ -1305,14 +1305,23 @@ body::after {
|
|||||||
.scrolly__caption {
|
.scrolly__caption {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: var(--space-4);
|
bottom: var(--space-4);
|
||||||
left: var(--space-4);
|
left: 50%;
|
||||||
right: var(--space-4);
|
right: auto;
|
||||||
|
transform: translateX(-50%);
|
||||||
font-family: var(--font-ui);
|
font-family: var(--font-ui);
|
||||||
font-size: var(--text-xs);
|
font-size: var(--text-xs);
|
||||||
color: rgba(255,255,255,0.65);
|
color: rgba(255,255,255,0.85);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
max-width: 85%;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
background: rgba(0,0,0,0.45);
|
||||||
|
padding: 0.2rem 0.65rem;
|
||||||
|
border-radius: 2px;
|
||||||
|
z-index: 2;
|
||||||
}
|
}
|
||||||
.scrolly__steps-content { display: none; }
|
.scrolly__steps-content { display: none; }
|
||||||
.scrolly-step { min-height: 60vh; display: flex; align-items: center; padding: var(--space-16) var(--space-8); }
|
.scrolly-step { min-height: 60vh; display: flex; align-items: center; padding: var(--space-16) var(--space-8); }
|
||||||
|
|||||||
@@ -63,10 +63,15 @@
|
|||||||
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
|
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
var progress = Math.min(window.scrollY / window.innerHeight, 1);
|
var scrollY = window.scrollY;
|
||||||
overlay.style.background = 'rgba(0,0,0,' + (progress * 0.65).toFixed(3) + ')';
|
var vh = window.innerHeight;
|
||||||
if (progress >= 1) overlay.style.display = 'none';
|
var heroEnd = vh * 1.4; // img-wrap (100vh) + spacer (40vh)
|
||||||
else overlay.style.display = '';
|
var mid = heroEnd * 0.5; // peak darkness at 70vh
|
||||||
|
var opacity = scrollY <= mid
|
||||||
|
? (scrollY / mid) * 0.65
|
||||||
|
: Math.max(0, (1 - (scrollY - mid) / (heroEnd - mid)) * 0.65);
|
||||||
|
overlay.style.background = 'rgba(0,0,0,' + opacity.toFixed(3) + ')';
|
||||||
|
overlay.style.display = (opacity < 0.002) ? 'none' : '';
|
||||||
if (!hidden && window.scrollY > 80) {
|
if (!hidden && window.scrollY > 80) {
|
||||||
cue.classList.add('is-hidden');
|
cue.classList.add('is-hidden');
|
||||||
hidden = true;
|
hidden = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user