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

Get deep insight into Node.js applications with real-time metrics, CPU profiling, and heap snapshots with N|Solid from NodeSource. Learn more.

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

Node.js application metrics sent directly to any statsd-compliant system. Get N|Solid

Topics:

Published at DZone with permission of Hirvesh Munogee, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}