When I resize my window in firefox it goes as planned. But when I resize my window in IE7(probably IE6 too, I don't have IE6 anymore) I get this error:
If I'm not mistaken IE doesn't support window.innerHeight. Check out document.body.clientHeight or document.documentElement.clientHeight instead for IE.
I tried switching it over from window.innerHeight to document.body.clientHeight and IE doesn't react and firefox keeps shrinking 30px every time I resize, apparently.
You got one more to try, "document.documentElement.clientHeight". You will have to do some browser sniffing for IE. I think just about every other browser is happy with "window.innerHeight" in this case IE is just the oddball.
My solution is going to be a little disappointing... the "document" resizes depending on your content (not the window), and browsers disagree about the viewport's size properties.
document.documentElement.clientHeight seems to be the most reliable property cross browser these days:
Even though I placed {$("#bodyContainer").height(wh - 30);} outside of the resize callback the element doesn't change height. It's only when I resize the window does this work.
Why? It shouldn't be a variable scope thing because of the "var" keyword isn't being use, should it?
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Here it is a bit smaller
[syntax="javascript"]
$(window).resize(function () {
if(window.innerHeight) wh = window.innerHeight;
else wh = (document.documentElement.clientHeight>0) ? document.documentElement.clientHeight : document.body.clientHeight;
$("#viewFrame").height(wh - 50);
});
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]