Scroll Driven Patterns
Ce contenu n’est pas encore disponible dans votre langue.
Embedded example animated gifs in this page have movement that may be problematic for some readers. Readers with vestibular motion disorders may wish to enable the reduce motion feature on their device before reading this page.
These patterns use the CSS scroll-driven API available from june 2023 in Chrome to create effects that are triggered by the user scrolling the page using only CSS.
Progress
The Progress element is a simple progress bar that fills as the user scrolls down the page. It is useful for showing the user how far they have scrolled through a page.
It renders the following html on front-end:
The dummy text which is inserted is there only for the purpose of having a long enough page to scroll and can be safely deleted.
The element has custom CSS which can be tweaked to style it.
To customize the element while keeping fuctionnality, I recommend changing only the following properties:
height
background
z-index
And if necessary to change its position:
left
top
width
Fancy Gallery
A central column scrolls with the page, while the left and right columns scroll in the opposite direction. This creates a parallax effect that can be used to display images or other content.
It renders the following html on front-end:
The functionality comes from the following class:
Hero2header
A full screen hero section that transitions into a header as the user scrolls down the page.
It renders the following html on front-end:
The dummy text which is inserted is there only for the purpose of having a long enough page to scroll and can be safely deleted.
The element has custom CSS which can be tweaked to style it.
To customize the element while keeping fuctionnality, I recommend changing only the following properties:
color
: the default text color in the element.background-image
: the image used as background. You can also use a gradient.background-blend-mode
: the blend mode used for the background image and the overlay color defined in the animation.
And in the animation @keyframes
:
font-size
from and to: font sizes. You will need to adjust to match your design.background-color
to: defines the overlay color when the hero shrinks to a headerblock-size
to: the size of the header when shrinked.
ImageReveal
This structure includes images with a custom CSS class that reveals images with a growing circle mask effect when entering the viewport as the page scrolls down.
It renders the following html on front-end:
The dummy text which is also inserted is there only for the purpose of having a long enough page to scroll and can be safely deleted.
The element includes a custom CSS class sez-reveal-image
which can be tweaked to style it.
To customize the element while keeping fuctionnality, I recommend changing only the following properties:
animation-range
: defines the start and end of the animation
And of course, you can change the animation itself by modifying the @keyframes
rule or choosing your own one.