I've been trying to understanding the way window width is determined and I was wondering if it's different for CSS and jQuery.
If for example I have the CSS media query:
@media (max-width: 979px) {
/*my css here*/
}
and also some jQuery:
if ($(window).width() < 979) {
//my jQuery here
}
I would expect the following: - When the browser is resized & refreshed at 980px, both of the above will be ignored - When the browser is resized & refreshed at 978px, both of the above will activate.
However what I'm finding is that - The jQuery and CSS don't kick in until about 964px and below. - Sometimes (if I have window.resize enabled) the jQuery and CSS kick in at seperate widths (a few pixels apart).
Can anyone shed any light on what's going on here?
By the way I'm basing the window width on Firebug's layout viewer.