Created
April 30, 2012 03:05
-
-
Save james2doyle/2555150 to your computer and use it in GitHub Desktop.
Easy conditional loading of assets with css and javascript
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
/* THE CSS */ | |
@media all and (min-width: 45em) { | |
body:after { | |
content: 'widescreen'; | |
display: none; | |
} | |
} | |
// THE JS | |
var size = window.getComputedStyle(document.body,':after').getPropertyValue('content'); | |
if (size == 'widescreen') { | |
// Load some more content. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment