DEV Community

loading...

Discussion on: Toggle content on click without javascript (Yes you read that right)

Collapse
fcrozetta profile image
Fernando Crozetta

Not gonna lie. I think this is really cool
I don't know much about front end, but this is really interesting to see and understand.
I have just one question: would be any performance differenced if this was implemented in static sites, for example?

Collapse
codenutt profile image
Jared

CSS Transitions are always going to be faster/smoother than JS. Whether it's static or not, shouldn't make a difference.

Collapse
fcrozetta profile image
Fernando Crozetta

This is Interesting. May I ask more?
But if it's faster/smoother that js, is there a reason why people don't use it more?

Thread Thread
codenutt profile image
Jared

I'm not sure what the answer to that is. Maybe because CSS is not often thought of like an animation solution? I dunno! CSS is also limited, you can't do everything. But you can do a lot!

Thread Thread
fcrozetta profile image
Fernando Crozetta • Edited

Thanks!
I was trying to understand if there was a reason to not use it.

Maybe because CSS is not often thought of like an animation solution?

You may be right. Thanks for taking time to answer my questions!

Thread Thread
codenutt profile image
Jared

Oh, nope! I always try and reach for plain CSS before JS for animations 👍🏼