Document.width - IE Error

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

I use $(document).width()and $(document).height().

Works great in FF and Chrome, but IE adds about 25 pixels to each, and I get scrollbars? What should I use, is it cross browser compatible?

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

+3
source share
3 answers

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

+6
source

: doctype ? , , IE quirks, , doctype.

, , , :

<!DOCTYPE html>

, .

+4

If you are trying to populate the view port $(window).width()and $(window).height()is what you want to use. It works in IE.

+1
source

Source: https://habr.com/ru/post/1771188/


All Articles