Modernizr load method

五迷三道 提交于 2019-12-03 20:37:01

It looks like you have a timing issue; init() is being called before jQueryUI is loaded, but it's a simple fix:

Modernizr.load({
  load: [
    'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js',
    'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'
  ],
  complete: function () {
    if ( !window.jQuery ) {
      Modernizr.load(
        load: [
          'js/plugins/jquery-1.7.1.js',
          'js/plugins/jquery-ui-1.8.16.js'
        ],
        complete : function(){
          init();
        });
    } else {
      init();
    }
  }
});

I haven't tested this code, but basically you need to wait until both jQuery and jQueryUI are loaded before you can call init();

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!