views:

61

answers:

3

I am trying to set the width and height of a mask behind a modal window.

I am using $(document).width() and $(document).height().

Works great in FF and Chrome but IE adds about 25px to each and I end up with scroll bars? What am I supposed to use that is cross browser compatible?

I am using IE8 btw, but I want it to work down to 6 or 7.

+2  A: 

Question: Are you using a doctype on your page? It sounds like the kind of glitch you may get if IE goes into quirks mode, which can be avoided if you use a doctype.

If you haven't got one, all you need is a very simple line at the top of your site:

<!DOCTYPE html>

Hope that helps.

Spudley
yes I do - I've tried <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> AND <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Blankasaurus
A: 

If you are trying to fill up the view-port $(window).width() and $(window).height() is what you want to use. Works in IE.

Blankasaurus
-1. Wow. Next time leave a comment. Seeing as I asked the question and this is what fixed my issue, I would say that this is a solid answer. I just want the next guy who runs into this to be able to fix it. Come back and leave a message.
Blankasaurus
+1  A: 

Just use $(window).width() & $(window).height() (demo).

galambalazs
+1 since this is what I ended up doing and some moron -1'ed you. =/
Blankasaurus
you're welcome :)
galambalazs
you mean thank you? =P
Blankasaurus
I mean happy Hanuka!
galambalazs