Keeps JavaScript and CSS in sync using a unique approach that allows you to control styles for responsive design without doing user-agent detection.
Notice the page adapting like it would normally using CSS media queries.
You can, but JavaScript may or not be in sync with your CSS media queries, so some of your users may be seeing layout/style changes, but any JavaScript that you need to run at a given browser size may not agree across browsers or with your CSS.
The page is actually responding to your screen width 100% on the client-side using the reliability of CSS media queries, but giving control to JavaScript, so that you can be sure they both think the browser is at the same size.
It uses CSS media queries to assign the width of an invisble element (<script> by default) and then JavaScript reads the width of that element and applies the needed CSS class (more information on the technique).
Here is what class(es) we currently have on the page:
Check this page in different browsers/devices and see what you get (report a bug).
screen.width | window.outerWidth | CSS media query | JSS media query |
---|---|---|---|