Transition from display: none
We can also now transition elements that are shown/hidden using the display
property! 😱
And not only that, you can also apply different entry and exit animations too.
/* ACTIVE STATE */
.modal[open] {
translate: 0 0;
display: block;
}
/* EXIT END STATE */
.modal {
display: none;
translate: 0 -100vh;
transition: 0.7s;
transition-behavior: allow-discrete;
}
/* ENTRY START STATE */
@starting-style {
.modal[open] {
translate: 0 100vh;
}
}
The below shows how the transition-behavior: allow-discrete
rule works.
Snap change from none to block
@starting-style styles
active styles
Snap change from block to none
active styles
non-active styles
Transition from display: none
Menu