What's the best way to utilize jQuery

Is there anyway to load jQuery-UI theme from CDN, but with local fallback? Similar to the javascript fall-back outline here? Google Hosted CDN with fall back


I would recommend using the resource loader yepnope:

yepnope([{
  load: 'http:/­/ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js',
  complete: function () {
    if ( !window.jQuery ) {
      yepnope('local/jquery.min.js');
    }
  }
}, {
  load: 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js',
  complete: function () {
    if ( !window.jQuery.ui ) {
      yepnope('local/jquery-ui.min.js');
    }
  }
}]);

This will first try to load jQuery with local fallback, then load jQUery UI with local fallback.

链接地址: http://www.djcxy.com/p/48094.html

上一篇: 哪个简单的文件管理系统?

下一篇: 什么是利用jQuery的最佳方式