Created
July 16, 2011 07:29
-
-
Save Victa/1086106 to your computer and use it in GitHub Desktop.
Testing CSS media queries in JS
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
if (window.matchMedia('only screen and (max-device-width: 480px)').matches) { | |
// Asynchronously load iphone.js | |
} else if (window.matchMedia('only screen and (min-device-width: 481px) and ' + | |
'(max-device-width: 1024px) and ' + | |
'(orientation: portrait)').matches) { | |
// Asynchronously load ipad-portrait.js | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment