Forked from jeremyboggs/load_theme_javascripts.php
Created
September 24, 2012 19:35
-
-
Save waynegraham/3777871 to your computer and use it in GitHub Desktop.
Function to add Modernizr, Respond.js, and Selectivizr to Omeka
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
<?php | |
/** | |
* Adds and displays the following JavaScript assets: | |
* | |
* - Modernizr - http://modernizr.com/ | |
* - Respond.js - https://github.com/scottjehl/Respond | |
* - Selectivizr - http://selectivizr.com/ | |
* | |
* Be sure to put copies of each in your theme's 'javascripts' directory. | |
*/ | |
function load_theme_javascripts() { | |
queue_js('modernizr.min'); | |
$respondSrc = src('respond.min.js', 'javascripts'); | |
$modernizrLoad = "Modernizr.load([{test: Modernizr.mq(), nope: " . "['$respondSrc']}]);"; | |
queue_js_string($modernizrLoad); | |
// Append Selectivizr using an IE conditional, so only IE8 and earlier use it. | |
__v()->headScript()->appendFile( | |
src( | |
'selectivizr.min.js', | |
'javascripts' | |
), | |
'text/javascript', | |
array( | |
'conditional' => 'lt IE 9' | |
) | |
); | |
// display_js automatically adds jQuery for us, which is needed for Selectivizr. | |
display_js(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment