My CSS code looks like this:
.foo
{
height:100px;
overflow:hidden;
-webkit-transition: height 200ms;
-moz-transition: height 200ms;
-o-transition: height 200ms;
transition: height 200ms;
}
.foo.open
{
height:auto;
}
When the .foo
class has an auto height, it typically results in a height of around 550px based on the content inside.
By applying the jQuery class open
, I anticipate a smooth transition from 100px to approximately 550px within 200ms using CSS3 transitions.
However, the actual behavior observed is a sudden change from 100px to 0px and then abruptly transitioning to ~550px.
Changing .open
to height:550px
works correctly as seen here, but since the content length may vary, setting a fixed pixel height is not feasible and hence the need for an automatic height adjustment.
Why does the div close instead of smoothly sliding to around 550px, and how can I fix this animation issue?