
The elastic button
Buttons, Hover, Text
A white nav bar with six links and a thin grip beside its right edge, in the simple style of product interface pieces. Dragging the edge narrows the bar, and the last link that no longer fits shrinks and flies into the More button, which takes it with a small kick while its count rolls up by one. Widen it and the links come back out one at a time, a pixel past their place, and settle.
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>
<!--
"Overflow nav bar" 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>The nav bar that tucks the extra links into More</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" data-stage>
<!-- one gesture: drag the edge; the links that no longer fit fly into More, one by one, and come back out -->
<div class="wrap" data-wrap>
<nav class="bar" data-bar aria-label="Main">
<span class="bar__pill" data-pill aria-hidden="true"></span>
<a class="bar__link" href="#work" data-link>Work</a>
<a class="bar__link" href="#studio" data-link aria-current="page">Studio</a>
<a class="bar__link" href="#journal" data-link>Journal</a>
<a class="bar__link" href="#pricing" data-link>Pricing</a>
<a class="bar__link" href="#careers" data-link>Careers</a>
<a class="bar__link" href="#contact" data-link>Contact</a>
<button class="more" type="button" data-more aria-haspopup="true" aria-expanded="false">
<span class="more__word">More</span>
<span class="more__badge" data-badge aria-hidden="true"><span class="more__num" data-num>0</span></span>
<svg class="more__chev" viewBox="0 0 12 12" aria-hidden="true"><path data-chev d="M3 4.6 6 7.6 9 4.6"/></svg>
</button>
<div class="panel" data-panel role="menu" aria-label="More links" hidden></div>
</nav>
<div class="grip" data-grip role="separator" aria-orientation="vertical" aria-label="Resize the bar" tabindex="0">
<span class="grip__bar" data-gripbar></span>
</div>
</div>
</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.
21 values to change
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 “Overflow nav bar” from Animorio and fit it into my siteEvery link is absolutely positioned and GSAP sets its x: the widths are measured once (offsetWidth, which transforms do not touch) and every place follows from them. Only More is pinned to the right edge by the CSS, so it follows the bar with no maths on every frame.
On every width change the script counts how many links fit while leaving room for More: if they all fit More is not needed, otherwise at least the first one stays. Only the links that change side move; the others stay where they are.
The leaving link goes to the centre of More shrinking to 0.6 with power3.in, as if sucked in; More takes the hit with x 1.6 and comes back with elastic.out. On the way back the link starts from the centre of More and lands in its place with back.out, which gives the extra pixel, and More pulls a hair the other way.
The count on More is a cell with hidden overflow: the old number leaves upwards when the links grow and downwards when they shrink, the new one comes in from the other side with back.out, and the cell swells by 14 per cent for a moment.
The grey pill under the links moves with x and width to the link you point at, then goes back to the page you are on; if that page has gone inside More the pill rests on More, and follows it while the bar changes width.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #3d5afe | The colour of the count on More and of the grip while held. |
MORE_LABEL | script.js | More | The word on the button that keeps the links that do not fit. |
SPRING | script.js | 1 | How much the links bounce coming back out: 0.4 calm, 2 very springy. |
SPEED | script.js | 1 | The speed of everything: 2 twice as fast, 0.5 half. |
STAGGER | script.js | 0.07 | The seconds between two links that go in or out together. |
AUTO | script.js | true | The edge moves by itself until someone touches the bar. |
For the top bar of a site or an app with more links than fit on a narrow screen: instead of switching straight to a hamburger, the extra links go into More one at a time and the first ones always stay in sight.
On the phone the bar starts as narrow as the screen, with some links already inside More, and the grip is pulled with a finger; there is no hover, everything else is the same.
The links do not fly: they fade out and back in at their place, the count changes without rolling and the panel fades in.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.1 KB; the libraries: GSAP 28 KB.
Tested on 31 October 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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
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.