Skip to content

Instantly share code, notes, and snippets.

@simonsmith
Created August 27, 2012 17:45
Show Gist options
  • Save simonsmith/3490742 to your computer and use it in GitHub Desktop.
Save simonsmith/3490742 to your computer and use it in GitHub Desktop.
AMD module to detect screen size based on body:after
http://adactio.com/journal/5429/
// Module given an id as I usually drop it in a main.js
// equivalent. It's hardly worth it's own file
// Returns a function so it can be called after DOMReady
define('mq', function() {
return function() {
return window.getComputedStyle(document.body,':after').getPropertyValue('content');
}
});
// Usage
require(['mq'], function(mq) {
if (mq() === 'phone') {
// pow pow
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment