How to determine if a window has really changed in the IE8 standard?

My site has many style sheets configured to change the width of the screen. As the browser resizes, the window.onresize event checks to see if the resize actually occurred by looking at document.documentElement.clientWidth. If this were the case, he would consistently include large style sheets until scrollbars appeared. Then it turns off in the reverse order until the scroll bars disappear. Scroll bars are detected by comparing offsetWidth with scrollWidth.

In IE8, two new issues make it difficult to detect resizing. One, onresize fires, when scrollbars appear or disappear, and two, d.dE.clientWidth reports the width without scrollbars, breaking with IE7 and all other browsers. My site now often falls into a loop in which the onresize logic activates a large stylesheet that creates scrollbars and then fires another resize event that cannot be filtered out because clientWidth has changed due to the appearance or disappearance of scrollbars. This would be a trivial solution if IE8 had something like outerWidth that I could check.

+5
source share
2 answers

onresize, , d.dE.clientWidth . d.dE.offsetWidth, onresize .

+3

- , IE8 , IE8 IE7 HTTP-.

+1

All Articles