Transition with display none
Is there a way to make this, but with
display: none;
. Or to fix visibility to use the available space? https://gyazo.com/c239c7d5de947aa501e712ff9448ea26Gyazo
Gyazo
24 Replies
You cannot directly transition
display
, as it's not an animatable property:
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties
You could use some JS to detect when the visibility transition is done and change the display property, thoughIs there a simple way to do it with JS?
I'm just filling up data right now (it's a lot ).
Something like this:
Might have to play with it a little (untested code)
However, you'll have to also add some functionality to reset the display before you transition again from visibility 0 to 1
https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionend_event
Use opacity or visibility. none removes from dom and it will shift and created layout shifts
DOM shifting is the point, though, so that invis elements don't take up space :p
if dom shifting is the point you should use FLIP
(at least that's my understanding)
also DOM shifting is never the point lol its very bad for preformance
"FLIP"?
Is that an acronym I'm not familiar with or did you use caps for emphaasis?
First last invert play
its a common pattern in the animation world
method rather*
And CSS Tricks to the rescue!
https://css-tricks.com/animating-layouts-with-the-flip-technique/
David Khourshid
CSS-Tricks
Animating Layouts with the FLIP Technique | CSS-Tricks
User interfaces are most effective when they are intuitive and easily understandable to the user. Animation plays a major role in this - as Nick Babich said,
Oh wow, okay I will need to check into that later.
For now, I guess I will simply use display.
https://myntsu.github.io/wind-cutter-guide/cooking.html
At least I finished everything.
Now I need to learn this FLIP thingy.
First time using grid on my own as well :D
@b1mind sorry to bother you. But what option do you think it would be the best to fix this firefox issue?
whats the issue?
^
Basically doesn't work entirely on firefox.
Because it uses has
to show the grid below.use JS to add the class that makes it visible?
good use of Event Delegation, put the event listener on the parent section. Then based on which is clicked you can add the class
So, a query selector for the label, that on clicks, displays the item beneath?
I would have to do 1:1 right, so 12 functions?
mmm I might add a dataset to pass too, would make it easier
Honestly this is the kinda stuff frameworks are great for. 😄
Yeah, I will look into that later then.
I just liked the
has
approach.Svelte would allow you to use FLIP animations really easy with its built in too >.>;;
But then boom, my day not fine, firefox I hate you.
:has() is brand new yea
I'm still new, so haven't dive into JS frameworks :'3
Eventually, and with time, I will.
respect yea learn the JS ways. Again look up Event Delegation for the click listener, then you could pass/check a data atrrib to add/remove class (or style based on that attribute)
you can combine that with attrib selector like you do now actually
I just choose to use datasets
Also just gotta say really nice demo using has
great work on this thus far 👍
I was trying to work on a multi-filter selection, but haven't figured out a way yet.
Like, if I select 2, then show me just this one specifically.
Maybe it's not possible, but that won't stop me from trying