xoxco/breakpoints — pull request #6 by rdebeasi (2012-01-25 17:20:31+00:00)
Title: More accurate calculations on non-WebKit browsers

Hello,

I've fixed a bug that I mentioned to you on Twitter a while back. The fix now works in all major browsers.

On most browsers, the value returned by $.width() doesn't include the scrollbar width. The one exception is WebKit. Media queries [do include the scrollbar width](http://www.w3.org/TR/css3-mediaqueries/#width).

As a result, when you run the current version of breakpoints.js on a non-WebKit browser, the breakpoint that's detected in JS is sometimes different from the breakpoint that is actually active. [(Screenshot)](http://cl.ly/CjR4)

To fix the problem, I'm using [jquery.getscrollbarwidth](https://github.com/brandonaaron/jquery-getscrollbarwidth/blob/master/jquery.getscrollbarwidth.js) to calculate the width of the scrollbar, then adding that value to the width that jQuery provides. On WebKit, I'm just accepting the width value without adding the scrollbar width.

Please let me know if you have any questions, and thanks for building this awesome script!

Best,
Ryan