So I am trying to use the CSS hack to set the max-height for a div in IE8 like this
height: expression( this.scrollHeight > 333 ? "333px" : "auto" );
I was wondering if anyone knew of a way to change that to a percentage, instead of a fixed pixel size? It would be fantastic if you could. Thanks!
Basically, I just want to say if this.scrollHeight is > window.height * .75 or something.
-Geoff
Not sure exactly what you want to accomplish but it can be done without javascript like this:
http://jsfiddle.net/KFyM4/6/
The trick is this:
And it works even in IE6. The only catch is that the parent element has to have a fixed height set so that it knows from what number to calculate the %.
So if you are doing it on browser window you will have to get the height of window and apply it to your
bodytrough javascript – rest can be done trough css.