Animations
Scroll reveals, stagger, counters and progress bars. For moving and fixed backgrounds see Parallax. Everything is switched on with data attributes. Delete the attribute and the effect is gone.
Setup
Add this to the page <head> (it adds the js class that lets content start hidden, and shows everything again if GSAP does not load or the visitor prefers reduced motion):
<script>document.documentElement.classList.add('js');if(window.matchMedia&&matchMedia('(prefers-reduced-motion: reduce)').matches)document.documentElement.classList.add('anim-off');setTimeout(function(){if(!window.__animReady)document.documentElement.classList.add('anim-off')},4000)</script> Load the scripts at the end of <body>, in this order:
<script src="../assets/vendor/gsap.min.js" defer></script>
<script src="../assets/vendor/ScrollTrigger.min.js" defer></script>
<script src="assets/js/animations.min.js" defer></script> Hero entrance
A hero uses the same attributes as the rest of the page. Put data-animate and data-animate-stagger on the box that holds the heading, text and buttons, and they come in one after another. Give the background image its own data-animate="fade-in".

Find a home that feels like yours
Browse verified listings and talk to local agents.
<div class="hero">
<div class="hero-bg" data-animate="fade-in">...</div>
<div class="hero-content" data-animate="fade-up" data-animate-stagger="0.15">
<h1>Heading</h1>
<p>Text</p>
<div>Buttons</div>
</div>
</div> Scroll effects
Each effect plays once when the element reaches about 85% of the viewport height.
fade-up
Scroll to see it
<div data-animate="fade-up">
fade-in
Scroll to see it
<div data-animate="fade-in">
fade-down
Scroll to see it
<div data-animate="fade-down">
slide-left
Scroll to see it
<div data-animate="slide-left">
slide-right
Scroll to see it
<div data-animate="slide-right">
zoom-in
Scroll to see it
<div data-animate="zoom-in">
More effects
Every effect below works the same way: change the value of data-animate. These cards replay each time you scroll past them. zoom-out is the soft "settle" used on hero images (it starts slightly larger and shrinks to its size). bounce-in, drop-in and elastic-in also use their own easing.
<div data-animate="flip-up"> Effects only move, scale, rotate, skew and fade, so they stay smooth. They also work on a stagger parent.
Delay, duration and repeat
Delay and duration
<div data-animate="fade-up" data-animate-delay="0.4" data-animate-duration="1.4"> Defaults: delay 0, duration 0.8 seconds.
Replay every time
<div data-animate="zoom-in" data-animate-once="false"> By default an effect plays once.
Stagger
Put data-animate-stagger on the parent. Its direct children (cards, for example) each animate when they scroll into view, using the effect set on the parent. Children that appear together play one after another.
<div class="row" data-animate="fade-up" data-animate-stagger="0.15">
Attributes
| Attribute | Where | Purpose |
|---|---|---|
data-animate | Any element | fade-up, fade-down, fade-in, slide-left, slide-right, slide-up, slide-down, zoom-in, zoom-out, zoom-in-up, zoom-in-down, zoom-in-left, zoom-in-right, rotate-in, rotate-left, rotate-right, flip-up, flip-down, flip-left, flip-right, skew-up, skew-left, bounce-in, drop-in or elastic-in. |
data-animate-delay | Same element | Seconds to wait. Default 0. |
data-animate-duration | Same element | Seconds. Default 0.8. |
data-animate-stagger | Parent | Seconds between children. Children animate one by one. |
data-animate-once | Same element | false to replay on every scroll. Default plays once. |
data-progress | Progress fill | Fill grows from 0 (width set with --w). See Progress bars. |
data-count | Number | Counts up from 0. Optional data-count-prefix, -suffix, -decimals. |
Only transform and opacity are animated. Animations are skipped for visitors who prefer reduced motion, and content stays visible if JavaScript or GSAP does not load.