JQUERY, div with a fixed height (with a scrollbar) how to animate until it grows to no longer need a

Posted by nobosh on Stack Overflow See other posts from Stack Overflow or by nobosh
Published on 2010-05-30T04:35:32Z Indexed on 2010/05/30 4:42 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

JQUERY, div with a fixed height (with a scrollbar) how to animate until it grows to no longer need a scroll bar?

I have a div on a page with a CSS height:200px setting, which makes the DIV have a vertical scroll bar, which allows the user to scroll through a bunch of text.

I would like to animate the DIV to expand in height until all content in the div is shown, meaning no more scroll bar

I tried the following:

$("#view-container").animate({"height": "auto"}, "slow");

but that didn't work while this does:

$("#view-container").animate({"height": "1000px"}, "slow");

problem with that is the text size in the DIV is variable. Ideas?

Thanks

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui