Forked from nternetinspired/Modernizr conditional loading
Created
November 16, 2012 12:40
-
-
Save cmarkle27/4087028 to your computer and use it in GitHub Desktop.
Conditional resource loading, using Modernizr's yepnope tests, based on viewport size. Placed immediately before the closing head tag in index.php this can be used to load specific resources against reported viewport sizes
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
<!-- Something like this --> | |
<script> | |
Modernizr.load({ | |
test: Modernizr.mq('(min-width:400px)'), | |
yep: '<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/not-small-screen-stuff.js">', | |
}); | |
</script> | |
<!-- Or --> | |
<script> | |
Modernizr.load({ | |
test: Modernizr.mq('(min-width:1024px)'), | |
yep: '<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/big-screen.css">', | |
nope: '<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/small-screen.css">', | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment