Animates an element shrinking to zero height, then hides it
Uses requestAnimationFrame to create a smooth height and padding collapse animation.
After animation completes, sets display:none and adds a 'closed' attribute.
Useful for accordion panels, dropdown menus, and dismissible notifications.
Parameters
container: {container:HTMLElement}
The element to animate and hide
Returns void
Example
constpanel = document.querySelector('.accordion-panel'); shrinkThenRemove({ container:panel }); // Panel smoothly collapses over 30 frames, then is hidden
Animates an element shrinking to zero height, then hides it
Uses requestAnimationFrame to create a smooth height and padding collapse animation. After animation completes, sets display:none and adds a 'closed' attribute. Useful for accordion panels, dropdown menus, and dismissible notifications.