Created
August 27, 2012 17:45
-
-
Save simonsmith/3490742 to your computer and use it in GitHub Desktop.
AMD module to detect screen size based on body:after
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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