Backdrop parallax in Firefox: a passive scroll fallback
Where scroll-driven animations are missing, a passive scroll handler writes the scroll position to --pb-y at most once a frame and the CSS moves each layer by its share, matching the scroll-timeline version. Off under reduced motion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2df908f7c4
commit
6506f65b1e
2 changed files with 41 additions and 3 deletions
|
|
@ -46,6 +46,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* The same rise where scroll-driven animations are missing: the
|
||||
scroll position arrives as --pb-y from PageBackdrop.tsx. */
|
||||
.page-backdrop[data-parallax="script"] .page-backdrop__circle {
|
||||
transform: translateY(calc(var(--pb-y, 0px) * var(--pb-speed) * -1));
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
@keyframes page-backdrop-rise {
|
||||
to {
|
||||
transform: translateY(calc(var(--pb-scroll, 0px) * var(--pb-speed) * -1));
|
||||
|
|
@ -53,8 +60,10 @@
|
|||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.page-backdrop__circle {
|
||||
.page-backdrop__circle,
|
||||
.page-backdrop[data-parallax="script"] .page-backdrop__circle {
|
||||
animation: none;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue