Tag Archives: EnquireJS

Introducing EnquireJS

via Introducing enquire.js.

For some time now, I’ve been using the enquire.js library to augment the use of media queries in JavaScript. I’ve had a lot of success using the library in various projects, but most developers I’ve met confessed they’ve never used or even heard of it.

In this article, I want to introduce you the library, explain why and how you’d want to use it.

Importing CSS Breakpoints Into Javascript

via Importing CSS Breakpoints Into Javascript | Lullabot.

A simpler way to keep your project’s CSS and JS in sync

There are a lot of challenges within responsive web design, and one that that has constantly been a pain is triggering JavaScript based on the current CSS media query breakpoint. The problem is that the breakpoints are in CSS, which JavaScript has no native way to access. Many solutions (including window.matchMedia(), and Enquire.js) involve declaring your breakpoints in both CSS and JS, or require IE10+. The problem with these solutions is that when you change a breakpoint value, you have to change it twice. However, it doesn’t need to be like this.