So, basically if a div reaches 50px I want to, then, turn on the scroll bar (vertcially). Any JQuery Ideas would be nice.
views:
41answers:
2
+4
A:
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.
patrick dw
2010-05-11 15:45:57
better answer than mine. I was thinking jquery.
aepheus
2010-05-11 15:47:40
Works from IE7 up, good to go.
Douglas
2010-05-11 15:48:48
@aepheus - Well, jQuery could be an appropriate solution too, depending on the situation. Might be easier than messing with IE CSS fixes.
patrick dw
2010-05-11 15:49:57
@Douglas - Thanks for the note. Wasn't sure about IE7.
patrick dw
2010-05-11 15:51:17
+1
A:
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');
aepheus
2010-05-11 15:46:51