I have created a "read more / read less" collapsable button with javascript, for the bio description of authors, on a wordpress site I am working on.
The collapsable is working fine, except that the transition css effect not working. I have tested this, and I think it is because when I uncollapse the text, i set the height to "auto", because obviously I don't know how long the text is going to be.
If I set the height to a number, the transition works. But I need to set to auto.
here is the fiddle: https://jsfiddle.net/brsastre/jo29pfm8/
p {
height: 30px;
overflow: hidden;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
p.uncollapsed {
height: auto;
}