Allow a div to only grow vertically for x amount of pixels then show scroll bar?
So, basically if a div reaches 50px I wa开发者_如何学Gont to, then, turn on the scroll bar (vertcially). Any JQuery Ideas would be nice.
You can do that in CSS, though max-height may require hacks for IE.
div {
max-height: 50px;
clip: auto;
overflow: auto;
}
If you have a specific jQuery use, you would need to share a little code.
When adding content to the div, check $('#something').height(). If it exceeds 50, set height to 50, and add scroll bars, otherwise leave it alone.
$('#something').css('height','50px').css('overflow','auto');
精彩评论