Enquire.js is a lightweight, pure JavaScript library for programmatically responding to CSS media queries. It is less than 1kb and has absolutely no dependencies. For an indepth look into Enquire.js you should check out the post on CSS Tricks.