I'm trying to let jQuery take care of a menu, while CSS does something to the window background when resizing the browser.
So jQuery does something like this:
if ( $(window).innerWidth() < mediaQueries['small']) {
// (where 'small' would be 966)
// Perform jQuery stuff on a menu ul
}
And CSS has something like this:
@media all and (max-width: 966px) {
body {
background: url(smallback.jpg) no-repeat 0 0;
}
}
When using Firefox, there's a gap of 17 pixels (which seems to be the vertical scrollbar width) in which the jQuery stuff is already handled, but the CSS is not.
As other browsers may use different widths for their scrollbars, just adding 17px to the CSS won't really fix the problem. So how do I get jQuery to take the scrollbars into account? $(window).innerWidth()
doesn't seem to do that for me.
Any help would greatly be appreciated.
Open this page in Firefox, Opera or IE for an isolated version of the problem. (Chrome and Safari don't suffer from this problem. Thusfar: Webkit: +1, Gecko: -1, Trident: -1, Presto: -1.)