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

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

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

Take a look at the Indigo.Design sample applications to learn more about how apps are created with design to code software.

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 }}