Snippet
|
|
Exampel
- Version-1: “Hello World Box Toggle” without Animation
- via using classanme
.hidden
anddisplay:none
to control hide/show behaviour
- via using classanme
- Version-2: … with Entry Animation
- via using
@starting-style
to describe the off-stage starting place styling when coming fromdisplay:none
- via using
- Version-3: … also with Exit Animation
- via using
transition-behavior:allow-discrete
andtransition:display 0.4s
to delay the applicaiton ofdisplay:none
for0.5s
, till after the transition animation has been played
- via using
(Source code can be found: here)
Reference
- https://css-tricks.com/almanac/rules/s/starting-style/ <– This one best explains the underlying mechnism
- https://nerdy.dev/using-starting-style-and-transition-behavior-for-enter-and-exit-stage-effects
- https://developer.mozilla.org/en-US/docs/Web/CSS/transition-behavior
- https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style