I do not recommend using the jQuery animation method because sometimes it does not work in some browsers. CSS slide transition animation is the best choice (for me) by setting div height or max height.
CSS
.expandable { max-height: 3em; overflow: hidden; transition: max-height .3s; }
when clicked, set max-height using jQuery:
$(.someSelector).css('max-height', expandedHeight);
Then remove the style when you click again:
$(.someSelector).attr('style', '');
You can watch this demo
source share