Skip to content

Instantly share code, notes, and snippets.

@starzonmyarmz
Created January 26, 2012 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starzonmyarmz/1685708 to your computer and use it in GitHub Desktop.
Save starzonmyarmz/1685708 to your computer and use it in GitHub Desktop.
Modernizr.load({
test: Modernizr.mq('only screen and (min-width: 768px)'),
yep : ['//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', 'js/plugins.js', '//fonts.googleapis.com/css?family=PT+Sans|PT+Sans+Narrow|Vollkorn:400italic,400'],
complete: function() {
if (window.jQuery) {
var images = '<li><img src="http://dummyimage.com/880x310/efefef/000.png"></li><li><a href="#"><img src="img/slide-marriage.jpg"></a></li><li><a href="#"><img src="http://dummyimage.com/880x310/123/fff.png"></a></li><li><a href="#"><img src="http://dummyimage.com/880x310/999/fff.png"></a></li>';
$('.slides').append(images);
Modernizr.load('js/script.js');
console.log('done');
}
}
});
@starzonmyarmz
Copy link
Author

I'm having the same issue as described here: http://goo.gl/VMUA1

This code is placed before the closing tag on my page. Everything seems to load fine (including the CSS from Google) - though it loads in a <script> tag. I'm using the CSS prefix plugin here: http://goo.gl/bWu3m and appended it to the end of my Modernizr library script file (in the ) of the document.

I was using the CSS! prefix which did resolve the 'Uncaught SyntaxError' error, but that was causing the 'complete' property to take 10 seconds (almost to the millisecond) to fire, which is why I removed it. I have a feeling that yepnope/Modernizr doesn't realize the google fonts are CSS because it lacks .css in the file name.

Any help would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment