开发者

jQuery change height on overflow

i have a div and its height is fixed to 100px right now.

but its data is not static and a user can add as much data as he wants, i dont want scroll bars and it should get resized to data contained in it(height only) is there any css property to achieve this except than min-h开发者_如何学Pythoneight as it doesnot work on IE.

the div may have multiple children and i am thinking to do something that doesnt involve calculating change of height of all children

thanks


height in IE6 is essentially min-height anyway. If you don't have a problem using quick hacks -

div.blah {
    _height:100px;
    min-height:100px;
}

...otherwise, tuck it in some Conditional Comments so you can sleep at night.

<!--[if IE 6]>
    <style type="text/css">div.blah { height:100px; }</style>
<![endif]-->


You can specify height:auto;overflow:visible;. This will make the <div> autosize itself.


overflow:visible; height:100px;

Should work, no?


Check out this plugin: http://james.padolsey.com/javascript/jquery-plugin-autoresize/

Hope I helped.


had to do using jQuery only calculated height of children and set it parent, css hacks dint helped

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜