Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Created April 30, 2012 03:05
Show Gist options
  • Save james2doyle/2555150 to your computer and use it in GitHub Desktop.
Save james2doyle/2555150 to your computer and use it in GitHub Desktop.
Easy conditional loading of assets with css and javascript
/* 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