Created
July 26, 2013 12:53
-
-
Save simondahla/6088619 to your computer and use it in GitHub Desktop.
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
$(document).ready(function() { | |
/*#### | |
Load in script only when a DOM element exists. | |
Use callback function to run | |
####*/ | |
Modernizr.addTest('foo', $('.bar').length > 0); | |
Modernizr.load({ | |
test: Modernizr.foo, | |
yep: 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js', | |
callback: function () { | |
//Run this when the 'foo' condition is met | |
$('.bar').console.log('I detected the "bar" class, loading in jQuery UI'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment