Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

fix: Hamburger Menu Toggle: Compare's copy stays hidden in See inside, so the items arrive one after another; Compare's Springy pose rests at the open place and the list is a little shorter on phones and short windows, so the lifted button stays below the names and inside the box

matined92f9fd06a1
diff --git a/animations/04-micro-interactions/hamburger-menu-toggle/index.html b/animations/04-micro-interactions/hamburger-menu-toggle/index.html
index d417e731..27f26969 100644
--- a/animations/04-micro-interactions/hamburger-menu-toggle/index.html
+++ b/animations/04-micro-interactions/hamburger-menu-toggle/index.html
@@ -74,7 +74,7 @@
/* See inside: captions, the button drawn twice as big and the menu in one row, none of it sliding */
.stage[data-hb-mode="inside"]{--zoom:2;display:grid;grid-template-columns:minmax(130px,210px) calc(76px * var(--zoom)) minmax(150px,280px);justify-content:center;align-content:center;align-items:center;column-gap:clamp(12px,3vw,28px);padding:10px 12px}
@media(min-width:761px) and (min-height:761px){.stage[data-hb-mode="inside"]{--zoom:2.6}}
- .stage[data-hb-mode="inside"] .pair{display:contents}
+ .stage[data-hb-mode="inside"] .pair:not(.twin){display:contents}
.stage[data-hb-mode="inside"] .caps{display:flex;flex-direction:column;align-items:flex-start;gap:6px;grid-area:1/1}
.stage[data-hb-mode="inside"] .burger{grid-area:1/2;justify-self:center;transform:scale(var(--zoom))}
.stage[data-hb-mode="inside"] .menu{grid-area:1/3;position:relative}
@@ -94,6 +94,8 @@
.stage[data-hb-mode="compare"].posed .ghost{display:block}
.stage[data-hb-mode="compare"] .ghost i:not(.gt):not(.gm):not(.gb){display:none}
@media(min-width:601px) and (max-height:629px){.stage[data-hb-mode="compare"] .sides .cap{justify-self:start;margin-left:calc(50% + 46px)}}
+ /* Springy lifts the button about 8px above its open place for a moment: the list sits a little shorter so that stays inside the box and below the names */
+ @media(min-width:601px) and (max-height:650px){.stage[data-hb-mode="compare"] .menu li{padding:7px 14px}}
@media(max-width:600px){
.stage[data-hb-mode="inside"]{--zoom:1.5;grid-template-columns:114px minmax(0,1fr);grid-template-rows:auto auto 114px auto auto;row-gap:3px;column-gap:12px;padding:6px 10px}
.stage[data-hb-mode="inside"] .caps{display:contents}
@@ -106,7 +108,7 @@
.stage[data-hb-mode="inside"] .menu ul{gap:4px}
.stage[data-hb-mode="inside"] .menu li{padding:10px 14px}
.stage[data-hb-mode="compare"] .pair{gap:10px}
- .stage[data-hb-mode="compare"] .menu li{padding:9px 14px}
+ .stage[data-hb-mode="compare"] .menu li{padding:7px 14px}
}
</style>
<link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">
@@ -365,7 +367,7 @@
const half=dur*HELD,p=curveAt(ease,HELD),[top,mid,bot]=btn.querySelectorAll('.bar');
stage.classList.add('posed');twinSet(true);
menu.setAttribute('aria-hidden','true');
- put(pair,{transform:`translateY(calc((50% - 38px) * ${1-p}))`});
+ put(pair,{transform:`translateY(calc((50% - 38px) * ${1-clamp(p)}))`});
put(btn,{borderColor:`color-mix(in srgb,var(--ui-accent) ${100*clamp(p)}%,var(--ui-border))`});
put(top,{transform:`translateY(calc((18px - var(--bar-h) / 2) * ${p})) rotate(${45*p}deg)`});
put(bot,{transform:`translateY(calc((var(--bar-h) / 2 - 18px) * ${p})) rotate(${-45*p}deg)`});