r/javascript • u/[deleted] • Aug 21 '18
Effectively supported in all browsers, JavaScript has its own form of media queries just like CSS.
https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia
465
Upvotes
r/javascript • u/[deleted] • Aug 21 '18
5
u/AwesomeInPerson Aug 22 '18
It is well supported and works flawlessly, so that's nice.
But in case you build a JS-powered web application, be aware that
window.matchMedia(orwindowin general) is not available in Node, so if you ever try to get into server-side-rendering, relying too much on it can really bite you!Learned that the hard way, lots of refactoring necessary...