Skip to content Skip to sidebar Skip to footer

Loading Scripts Using Modernizr... Not Working

I'm having problems trying to load scripts using the Modernizr version of yepnope and can't get my head around why they are different. If I load the scripts using yep nope it works

Solution 1:

UPDATE: Modernizr.load has been deprecated in version 3.0 in favour of using YepNope.js directly.

It's worth noting that Modernizr.load just uses the yepnope library and they are interchangeable. e.g.

yepnope({
  test : Modernizr.geolocation,
  yep  : 'normal.js',
  nope : ['polyfill.js', 'wrapper.js']
});

Modernizr.load({
  test : Modernizr.geolocation,
  yep  : 'normal.js',
  nope : ['polyfill.js', 'wrapper.js']
});

For yours, try:

Modernizr.load({
    load: [  
        '/js/fancy-box-2.0.4/jquery.fancybox.css',  
        '/js/jquery-1.7.min.js',  
        '/js/jquery.form-defaults.js',  
        '/js/jquery.cycle.all.js',  
        '/js/jquery.easing.1.3.js',  
        '/js/fancy-box-2.0.4/jquery.fancybox.js',  
        '/js/functions.js',  
        'http://use.typekit.com/uoy8fub.js'
    ]
}); 

Solution 2:

Modernizr needs a test to decide what to do. Generally Modernizr.load is used to load polyfills so you should read this: http://www.modernizr.com/docs/#load

Post a Comment for "Loading Scripts Using Modernizr... Not Working"