· 3 min read
A header that detaches and a footer that hints, with scroll-driven animations
Saved julibe.com (and its Pillars page) to my notes as inspiration. From it I picked: the colored scrollbar, the top menu detaching on scroll, and the hidden…
What we did
- Saved julibe.com (and its Pillars page) to my notes as inspiration. From it I picked: the colored scrollbar, the top menu detaching on scroll, and the hidden footer that hints there's more. Not the audio. Section snapping waits for the landing layout.
- Scrollbar: thin, accent thumb on the page background.
- Header: at the top it sits flat with the page. Over the first 5rem of scrolling it lifts into a floating bar (border, rounded corners, see-through blurred background, shadow). Sticky from 48rem; on phones it's two rows tall, so it scrolls away.
- Footer: its content slides in as it enters the screen. Until then, a green chevron tab bobs at the bottom of the screen and fades out as the footer arrives. Clicking it scrolls to the footer.
- Tested on the built site at 320px and desktop, in both themes, and with reduced motion.
What I learned
animation-timelinereplaces time with something else.scroll()is the page's scroll position;view()(or a namedview-timeline) is one element crossing the viewport.animation-rangesets where 0% and 100% are. The header uses0 var(--size-10): the whole animation happens in the first 5rem of scroll. The footer usesentry 0% entry 100%: from the moment it starts entering until it's fully in.view-timeline: --footeron the footer gives the timeline a name, so its children (the hint, the content) can use it.- The header's normal styles are the floating bar; the keyframes only have a
from(flat). Where scroll-driven animations aren't supported, or with reduced motion, the animation doesn't run and you get the finished look. - The same idea for the hint: it's
display: noneunless the animation can run, because without it nothing would ever hide it. - Two animations on one element would fight over the same property, so the time-based bob runs on the
svgand the scroll-driven fade on the link. - Everything sits in
@supports (animation-timeline: …)plus@media (prefers-reduced-motion: no-preference). - The hint is decoration:
aria-hidden="true"andtabindex="-1". Keyboard and screen reader users reach the footer normally. scrollbar-colorandscrollbar-widthare the standard properties (Firefox, Chrome 121+); no need for::-webkit-scrollbar.scroll-behavior: smoothonly insideno-preference, so in-page jumps don't glide for people who asked for less motion.
Links
- MDN: CSS scroll-driven animations
- MDN: animation-range
- scroll-driven-animations.style by Bramus, demos and a range visualizer
- MDN: scrollbar-color
Next
- The landing layout: sticky intro, scroll-spy nav, snapping.