Skip to content

Instantly share code, notes, and snippets.

@kennyadsl
Created July 25, 2011 08:12
Show Gist options
  • Save kennyadsl/1103747 to your computer and use it in GitHub Desktop.
Save kennyadsl/1103747 to your computer and use it in GitHub Desktop.
Check mediaquery with jquery
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