Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's what I (sort of) learned the hard way :) So most useful animations like the collapsing list item in the article are nigh impossible in CSS.


That's true, there are some limitations. Sometimes you can still do those sort of things in CSS if you set the target values using JS (instead of changing height to 0, change scaleY to 0 and translate up the elements from below with the height of the element that was removed). If all elements are same height, or the height is known beforehand you can just hardcode that translate value into the animations.


> instead of changing height to 0, change scaleY to 0 and translate up the elements from below with the height of the element that was removed

This will leave a gap below the elements

> If all elements are same height, or the height is known beforehand you can just hardcode that translate value into the animations.

The problem is that there's rarely if ever a case when you know the height of all elements on a page :(


> This will leave a gap below the elements.

Recursively apply same logic to rest of page!


Ah! Didn’t think about that :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: