Closed indrek-k closed 10 years ago
I can also attest to this. I am seeing exactly a 15px difference between my media queries and the actual reported breakpoint in Windows+Chrome.
My current project requires all scripts to be in the head (limitations of client's framework), so the only way I can get around this is wrapping Response in a window.load function. However, this is less than ideal because I cannot start writing any of my additional responsive logic until after the page has fully loaded.
Does anyone have an immediate change that I can make to fix this? I badly need to get this working ASAP! Any help would be MUCH appreciated!!
I'll fix this tonight and release new patch version. I've already fixed it in verge.
Amazing. Thanks soo much!
@JakedUp You're welcome!
Example: if you include response.js in document head and the document is long enough to have a scrollbar, calling Response.viewportW() will always return clientWidth.
It seems that
docElem['clientWidth'] < win['innerWidth']
is evaluated only once - when the browser first loads response.js. For example, if clientWidth and innerWidth are initially equal (i.e. no scrollbar), the comparison (line 94) will evaluate to false, thus setting Response.viewportW() to always return clientWidth. If a scrollbar appears later, nothing changes and clientWidth will still be returned, even though innerWidth is now bigger. Which means on win/chrome the returned value is off by 15px.