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