【发布时间】:2010-10-23 15:41:49
【问题描述】:
我计划使用 Google 下载 UI 和 Core 的 jQuery 库。我的问题是,他们允许我为它下载 CSS 还是我必须自己托管它?
另外,如果我使用谷歌加载我应该如何加载其他插件?我可以将所有插件压缩在一起还是应该是单独的文件?
【问题讨论】:
标签: jquery css jquery-ui cdn google-ajax-libraries
我计划使用 Google 下载 UI 和 Core 的 jQuery 库。我的问题是,他们允许我为它下载 CSS 还是我必须自己托管它?
另外,如果我使用谷歌加载我应该如何加载其他插件?我可以将所有插件压缩在一起还是应该是单独的文件?
【问题讨论】:
标签: jquery css jquery-ui cdn google-ajax-libraries
正如奥巴马所说的“是的,我们可以”。这是它的链接。 developers.google.com/#jquery
你需要使用
谷歌
ajax.googleapis.com/ajax/libs/jqueryui/[VERSION NO]/jquery-ui.min.js
ajax.googleapis.com/ajax/libs/jqueryui/[VERSION NO]/themes/[THEME NAME]/jquery-ui.min.css
jQuery CDN
code.jquery.com/ui/[VERSION NO]/jquery-ui.min.js
code.jquery.com/ui/[VERSION NO]/themes/[THEME NAME]/jquery-ui.min.css
微软
ajax.aspnetcdn.com/ajax/jquery.ui/[VERSION NO]/jquery-ui.min.js
ajax.aspnetcdn.com/ajax/jquery.ui/[VERSION NO]/themes/[THEME NAME]/jquery-ui.min.css
在画廊子标签http://jqueryui.com/themeroller/ 中查找主题名称
.
但我不推荐您从 cdn 托管,原因如下
http://zoompf.com/blog/2010/01/should-you-use-javascript-library-cdns
【讨论】:
jQuery 现在拥有 CDN 访问权限:
code.jquery.com/ui/[版本]/themes/[主题名称]/jquery-ui.css
为了让这更容易一点,你去吧:
【讨论】:
url语句都是相对于css文件位置的,客户端会自动从CDN抓取图片跨度>
包含 jQuery UI(当前为 v1.10.3)的 Google AJAX 库 API 还包含 jQuery UI blog 中的流行主题:
Google Ajax 库 API (CDN)
未压缩:http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js
压缩:http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js
未压缩的主题: black-tie,blitzer,cupertino,dark-hive,dot-luv,eggplant,excite-bike,flick,hot-sneaks,humanity,le-frog,mint-choc,overcast,pepper-grinder,redmond,smoothness,south-street,start,sunny,swanky-purse,trontastic,ui-darkness,ui-lightness,和vader。 >
主题压缩: black-tie,blitzer,cupertino,dark-hive,dot-luv,eggplant,excite-bike,flick,hot-sneaks,humanity,le-frog,mint-choc,overcast,pepper-grinder,redmond,smoothness,south-street,start,sunny,swanky-purse,trontastic,ui-darkness,ui-lightness,和ui-lightness。 >
【讨论】:
如果你指的是 jQuery UI css,你可以使用这个:
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
【讨论】:
Google 在此链接 https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.css 托管 jQueryUI css
如果你直接看这段代码,它正在使用@import which can be slow 导入css。您可能希望将导入分解为其部分以获得轻微的性能优势:
https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.base.css https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.theme.css
【讨论】:
我会这么认为。为什么不?没有提供 CSS 来支持脚本文件的 CDN 不会太多
This link 表明他们是:
我们发现特别令人兴奋的是 jQuery UI CSS 主题现在是 托管在 Google 的 Ajax 库 CDN 上。
【讨论】: