Within my ul are li elements with varying widths that wrap around inside a container into multiple rows. When removing an li element from the ul, I want the container's height to adjust dynamically in case a row is eliminated.
If the removal happens in the last row, I smoothly animate the height of the li element to zero before deletion.
The issue arises when an element from a row other than the last one is removed, creating enough space for all elements in the final row to move up. Because the element isn't from the last row, the height animation doesn't trigger, resulting in a sudden change in the ul and container heights when the last row changes.
Is there a workaround for this situation, or am I resigned to dealing with this abrupt shift?
For instance:
Visit this link for more examples.
UPDATE: Here's my solution below, accompanied by a working fiddle: Accessible here.