Detect dynamic media queries with JavaScript?
问题 I've been searching for a lightweight, flexible, cross-browser solution for accessing CSS Media Queries in JavaScript, without the CSS breakpoints being repeated in the JavaScript code. CSS-tricks posted a CSS3 animations-based solution, which seemed to nail it, however it recommends using Enquire.js instead. Enquire.js seems to still require the Media Query sizes to be hardcoded in the script, e.g. enquire.register("screen and (max-width:45em)", { // do stuff } The Problem All solutions so