
The star rating
Ratings, SVG, Hover
The pop-up that stops someone about to leave the cart: the top edge stretches towards the rising pointer, snaps as it leaves and throws in the window with the discount. The code can be copied, the closed window becomes a tab under the total, and Apply rolls the total down to the new price.
A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.
<!doctype html>
<!--
"Exit-intent pop-up" from Animorio · https://animorio.com
License: free on your own sites and your clients’ sites, paid work included.
Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Exit-intent pop-up</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- an exit-intent pop-up: the top edge of the cart stretches towards a pointer that is about to leave,
snaps as it goes and throws in the offer; the code can be copied, kept as a tab or applied to the total -->
<section class="xp" data-xp aria-label="Cart">
<svg class="xp__shape" data-shape aria-hidden="true"><path data-edge></path></svg>
<button class="xp__grip" data-grip type="button" aria-label="Leave the page"><i></i></button>
<div class="xp__page" data-page>
<header class="xp__head"><h2>Your cart</h2><span>2 items</span></header>
<ul class="xp__rows">
<li><i class="xp__tile xp__tile--a" aria-hidden="true"></i><span class="xp__what"><b>Linen overshirt</b><span>Sand, size M</span></span><span class="xp__price">€52.00</span></li>
<li><i class="xp__tile xp__tile--b" aria-hidden="true"></i><span class="xp__what"><b>Canvas tote</b><span>Olive</span></span><span class="xp__price">€32.00</span></li>
</ul>
<div class="xp__total">
<span>Total</span>
<span class="xp__tag" data-tag></span>
<span class="xp__sum" aria-live="polite"><span class="xp__roll"><span data-sum></span></span></span>
</div>
<button class="xp__pill" data-pill type="button">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2.500 6.200V3.500a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v2.700a1.800 1.800 0 0 0 0 3.600v2.700a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1V9.800a1.800 1.800 0 0 0 0-3.600Z"></path><path d="M9.800 2.900v10.200" stroke-dasharray="1.6 1.9"></path></svg>
<span data-pill-text></span>
</button>
<button class="xp__go" type="button">Check out</button>
</div>
<div class="xp__pop" data-pop role="dialog" aria-modal="true" aria-labelledby="xp-title" tabindex="-1">
<button class="xp__x" data-close type="button" aria-label="Close"><svg viewBox="0 0 14 14" aria-hidden="true"><path d="M3 3l8 8M11 3l-8 8"></path></svg></button>
<p class="xp__eyebrow" data-part>Before you go</p>
<h3 class="xp__title" id="xp-title" data-part data-title></h3>
<p class="xp__sub" data-part>Your two items are still here. We’ll hold this code for <b data-clock>10:00</b>.</p>
<div class="xp__coupon" data-part data-coupon>
<span class="xp__code" data-code aria-label="Discount code"></span>
<button class="xp__copy" data-copy type="button"><span class="xp__roll"><span data-copy-text>Copy</span></span></button>
<i class="xp__bar" aria-hidden="true"><b data-bar></b></i>
</div>
<button class="xp__apply" data-part data-apply type="button">
<svg viewBox="0 0 18 18" aria-hidden="true"><path data-tick pathLength="1" d="M4 9.400 7.600 12.800 14 5.600"></path></svg>
<span class="xp__roll"><span data-apply-text>Apply and check out</span></span>
</button>
<button class="xp__no" data-part data-no type="button">No thanks</button>
</div>
<i class="xp__cursor" data-cursor aria-hidden="true"><svg viewBox="0 0 22 22"><path d="M4 2.500 17.500 10l-5.900 1.700-2.700 5.800Z"></path></svg></i>
</section>
</main>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
<script src="script.js"></script>
</body>
</html>Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.
32 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:
Take “Exit-intent pop-up” from Animorio and fit it into my siteThe outline of the cart is one SVG path. Its top side has a bump made of two Bézier curves: the position follows the pointer, the height grows with a power of how close it is to the edge. It is redrawn only while it moves.
The height of the bump is a spring integrated on GSAP’s ticker: stiff and damped while it follows the pointer, soft and barely damped once it loses it, so the edge snaps and swings below and above the line before it rests.
The signal is pointerleave through the top side of the panel; on a full page it is the document’s mouseleave with clientY at zero or less. With no pointer, the grip on the edge is a real button and does the same.
The window comes in with its transform origin at the point of the edge the pointer left through. Closed unused, it moves and scales to the centre of the tab, measured at that moment; opened again, it takes the same road back.
role=dialog with aria-modal, inert while closed, Tab cycling through its buttons, Esc closing and focus going back to the tab. The code’s time runs on the ticker and stops once the code is applied.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #e4572e | The colour of the offer: the eyebrow, the ticket, the tab. |
GOOD | script.js | #159a5c | The colour of the copied code and the applied discount. |
CODE | script.js | STAY10 | The discount code written on the ticket. |
OFFER | script.js | 10 | The discount, in percent: it changes the headline and the total after Apply. |
TOTAL | script.js | 84 | The cart total before the discount, in euros. |
HOLD_MIN | script.js | 10 | How many minutes the code is held for: the count starts at the first opening. |
REACH | script.js | 54 | How many pixels from the top the edge starts stretching towards the pointer. |
STRETCH | script.js | 15 | How many pixels at most the edge stretches before it snaps. |
LOOP | script.js | true | Left alone, the demo’s pointer tries to leave, copies the code, closes, reopens and applies. |
On the cart or product page of an online shop, for someone about to leave without buying; with other words, for a blog’s newsletter signup or a service’s free trial. Once per visit: whoever closed it finds it in the tab, not in their face again.
A phone has no pointer to leave with: tap the grip on the top edge, the edge snaps and the window comes in the same way. On a real site the right signal is the back button or a fast scroll back up. Everything fits the width of the screen, with buttons 36 to 48 pixels tall.
The edge stays straight, the window and the tab fade in and out, the letters do not hop and the total changes without rolling. The code’s time still counts down.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 9.4 KB; the libraries: GSAP 28 KB.
Tested on 20 November 2026
Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.