开发者

document.width - IE Bug

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 t开发者_开发百科o work down to 6 or 7.


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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜