JS - Dynamic div content, but need a fixed div height.

Posted by Joey Morani on Stack Overflow See other posts from Stack Overflow or by Joey Morani
Published on 2010-05-16T13:18:09Z Indexed on 2010/05/16 13:20 UTC
Read the original article Hit count: 196

Filed under:
|
|
|
|

Hello. I'm using javascript to animate a div collapsing/sliding. The javascript requires the div to have a set height, although the content inside the div is dynamic. How would I go about making it work, as I don't want the div to be any larger than it's meant to. I've set the height of the div like this:

<div id="main-div" style="overflow:hidden; height:95px;">

I've tried setting the height to 'auto' but when the div slides open again, it doesn't slide to the correct height. Would I need to calculate the height? Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about height