News for hackers. Stuff that matters.
Re:Gov.uk drops jQuery from their front end by Cthulhu_ on Thursday May 19, 2022 @10:23AM (#31435037)
In 2020, a collapsible section is a matter of adding / removing a classname and a CSS animation; there's a few ways to do so, using jQuery is one, but you don't need thousands of lines of a JS library (network bandwidth + JS interpretation) to achieve that.
Re:Gov.uk drops jQuery from their front end by have_faith on Thursday May 19, 2022 @10:52AM (#31435432)
Can CSS transitions and animations handle animating to auto height/widths yet?
Re:Gov.uk drops jQuery from their front end by d1sxeyes on Thursday May 19, 2022 @11:31AM (#31435997)
I don't think so. One trick I've used to good effect is setting an high max-height, then translating by 100% and removing pointer events.
Re:Gov.uk drops jQuery from their front end by flatcakes on Thursday May 19, 2022 @11:37AM (#31436095)
I feel like this solution feels subtly "wrong" if you're animating, because that high max height will be arbitrarily far away from where you'd normally want to animate to. Doubly so for easing out.
Re:Gov.uk drops jQuery from their front end by d1sxeyes on Thursday May 19, 2022 @12:00PM (#31436361)
Yeah it's a bit weird, but haven't found a better trick yet.