javascript - How can I get IE's width without scrollbar -


I get the width of the browser using the following line:

  $ (document)  

. Width ()

And then I set the element to this width.

But in IE, the horizontal scrollbar appears (the width is larger than the browser size. I think it looks like the width of the vertical scrollbar is counted). I'm using html 4.0 infections. What should I do?

Try the clientwidth property, such as:

  $ ('body'). Attr ('clientWidth')  

From the Mozilla Developer Center:

The clientWidth is the inner width of an element in pixels, including padding, but vertical scrollbar (If present, if provided), boundary or margin

from MSDN:

Recover the breadth of the object with padding, but Margins, borders, or scroll bars are not included.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -