I need animate showing and hiding div element. Is there any JS library or CSS trick, that makes it possible? I know about jQuery and similar, but they’re too big – I don’t want use more than ~5 KB.
I also tried CSS transition, but it doesn’t allow use display property. Visibility takes up place in page, what is undesirable.
EDIT:
For example:
jQuery.toggle().
The second Demo from the top.
Use CSS transitions. You don’t need to touch the display property.
You can set the height/width (or both) of your div to 0, and then to your desired size, and activate the transition.
Or, you can fly in/fly out divs from your page if you animate their position (start from outside of the page and fly in to the desired position, and vice versa). You can slide them in from the top, or from left/right.