Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Javascript onMediaQuery - A Neat Way To Trigger JavaScript When Media Queries Change

DZone's Guide to

Javascript onMediaQuery - A Neat Way To Trigger JavaScript When Media Queries Change

· Web Dev Zone ·
Free Resource

Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.

Javascript onMediaQuery is a neat way to trigger JS when media queries change.  Jeremy Keith recently posted a fantastic way of getting CSS and Javascript to talk media queries with the CSS :after pseudo-property.  This has a number of advantages over using window.matchMedia(), namely that you only have to maintain your breakpoints in one place, and it fails more gracefully.

Requirements: None
Demohttps:/ / github. com/ JoshBarr/ js-media-queries
License: MIT License

What’s the best way to boost the efficiency of your product team and ship with confidence? Check out this ebook to learn how Sentry's real-time error monitoring helps developers stay in their workflow to fix bugs before the user even knows there’s a problem.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}