JS - Dynamic div content, but need a fixed div height.
- by Joey Morani
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.