Blog archive for May 2017
Animate div with max-height using CSS and jQuery
May 11th 2017
1161

Recently we ran into an annoying problem. Say you have a div with some dynamic text. Sometimes the text is short, so should be displayed in its entirety. Other times - it’s too long, so should be partly hidden. However, differently from hiding the text completely and then using jQuery’s .slideDown() of simply .show(), we wanted to display first few lines of it and give user the ability to show the rest. Also, and this part is very important - the revealing of the whole text should be animated (sort of the .slideDown() effect).