דילוג לתוכן הראשי
[attribute]section transitionWhile scrolling

Cover Hero

ה-hero שוקע למטה בזמן הגלילה, ו-overflow: hidden חותך את מה שיורד, כך שהרקע של הסקשן עצמו עולה מלמטה כמו מסך. שני אטריביוטים, בלי sticky ובלי pin: הסקשן הבא פשוט עולה. חי ב-hero של Verdis.

משתלב טוב עם כניסת מלל בסקשן שאחרי: split או split="blur" על הכותרת שלו. בזמן שה-hero שוקע הכותרת נכנסת, וזה מעצים את האפקט. ה-"Next Section" בדמו למטה עושה בדיוק את זה עם split="".

למעט תוכן בלבד: כותרת ושורה-שתיים. כל התוכן יושב absolute בתוך מסגרת בגובה מסך עם overflow: hidden, אז הוא לא יכול להגדיל אותה. עם יותר תוכן, או בזום גדול בדפדפן (150% ומעלה, שמתנהג כמו מסך קטן), הוא פשוט נחתך. אם צריך יותר: min-height על הסקשן ו-inner בזרימה (לא absolute), כמו ב-hero של Verdis.

<section data-cover-hero="" style={{ height: '100svh', overflow: 'hidden', background: '#1a1814' }}>
  <div data-cover-hero-inner="" style={{ position: 'absolute', inset: 0 }}>
    {/* full-bleed image + overlay + text */}
  </div>
</section>
Cover Hero demo

Cover Hero

Scroll to reveal

Next Section

Cover Hero on a light section

Cover Hero

On a light section

Next Section

It is not a dark-section effect. What rises from the bottom is the section's own background, so any colour works: the two demos above are the same attribute on ink and on cream.

The one thing that has to travel with the colour is the overlay. Build it with color-mix from the same token as the section background, never a hardcoded rgba(0,0,0,…): that is what makes the picture dissolve into the curtain as it sinks. With a black overlay on a light section you get a grey veil that matches nothing and the illusion breaks.

/* section */  background: var(--brand-ink);

/* overlay, mixed from THAT token: swap the token, the fade follows */
background: linear-gradient(to bottom,
  color-mix(in oklch, var(--brand-ink) 12%, transparent) 0%,
  color-mix(in oklch, var(--brand-ink) 38%, transparent) 55%,
  color-mix(in oklch, var(--brand-ink) 92%, transparent) 100%);
data-cover-hero=""
On the <section>. Requires overflow: hidden and a height (100svh for a hero).
data-cover-hero-inner=""
On the inner wrapper div. Must be position: absolute; inset: 0. Holds all content: image + text.

No sticky: a plain section, scrolled out

מהעל מימה קורהעד מתי
גדילההתמונות, עם data-hero-parallax-scalescale מ-1 לערך שנכתבעד שתחתית הסקשן בראש המסך
שקיעההעטיפה, data-cover-hero-innerיורדת בחצי גובה מסך, ו-overflow: hidden חותךעד שתחתית הסקשן בראש המסך
שקיפותהעטיפה, data-cover-hero-inneropacity עד 0עד 85% מהטווח