我打算使用谷歌为UI和Core下载jQuery lib . 我的问题是,他们允许我为它下载CSS还是我必须自己托管它?
此外,如果我使用谷歌加载我应该如何加载其他插件?我可以将所有插件压缩在一起,还是应该是它自己的单独文件?
Google AJAX Libraries API包含jQuery UI(目前为v1.10.3),还包含了jQuery UI blog的热门主题:
Google Ajax Libraries 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,和vader .
jQuery现在有一个CDN访问权限:
code.jquery.com/ui/ [version] / themes / [theme name] /jquery-ui.css
为了使这更容易一点,你走了:
base:http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css
黑色领带:http://code.jquery.com/ui/1.9.1/themes/black-tie/jquery-ui.css
blitzer:http://code.jquery.com/ui/1.9.1/themes/blitzer/jquery-ui.css
cupertino:http://code.jquery.com/ui/1.9.1/themes/cupertino/jquery-ui.css
dark-hive:http://code.jquery.com/ui/1.9.1/themes/dark-hive/jquery-ui.css
dot-luv:http://code.jquery.com/ui/1.9.1/themes/dot-luv/jquery-ui.css
茄子:http://code.jquery.com/ui/1.9.1/themes/eggplant/jquery-ui.css
激动自行车:http://code.jquery.com/ui/1.9.1/themes/excite-bike/jquery-ui.css
电影:http://code.jquery.com/ui/1.9.1/themes/flick/jquery-ui.css
热偷偷摸摸:http://code.jquery.com/ui/1.9.1/themes/hot-sneaks/jquery-ui.css
人性:http://code.jquery.com/ui/1.9.1/themes/humanity/jquery-ui.css
le-frog:http://code.jquery.com/ui/1.9.1/themes/le-frog/jquery-ui.css
mint-choc:http://code.jquery.com/ui/1.9.1/themes/mint-choc/jquery-ui.css
阴 Cloud 密布:http://code.jquery.com/ui/1.9.1/themes/overcast/jquery-ui.css
pepper-grinder:http://code.jquery.com/ui/1.9.1/themes/pepper-grinder/jquery-ui.css
redmond:http://code.jquery.com/ui/1.9.1/themes/redmond/jquery-ui.css
平滑度:http://code.jquery.com/ui/1.9.1/themes/smoothness/jquery-ui.css
南街:http://code.jquery.com/ui/1.9.1/themes/south-street/jquery-ui.css
开始:http://code.jquery.com/ui/1.9.1/themes/start/jquery-ui.css
晴天:http://code.jquery.com/ui/1.9.1/themes/sunny/jquery-ui.css
swanky-purse:http://code.jquery.com/ui/1.9.1/themes/swanky-purse/jquery-ui.css
trontastic:http://code.jquery.com/ui/1.9.1/themes/trontastic/jquery-ui.css
ui-darkness:http://code.jquery.com/ui/1.9.1/themes/ui-darkness/jquery-ui.css
ui-lightness:http://code.jquery.com/ui/1.9.1/themes/ui-lightness/jquery-ui.css
vader:http://code.jquery.com/ui/1.9.1/themes/vader/jquery-ui.css
Google正在此链接中托管jQueryUI css https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.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
我想是的 . 为什么不?不会有很多CDN没有提供CSS来支持脚本文件
This link表明它们是:
我们发现jQuery UI CSS主题现在托管在Google的Ajax Libraries CDN上特别令人兴奋 .
如果你的意思是jQuery UI css,你可以使用这个:
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
正如奥巴马所说"Yes We Can" . 这是它的链接 . developers.google.com/#jquery
你需要使用
Google
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
Microsoft
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
在gallery子选项卡中查找主题名称http://jqueryui.com/themeroller/
.
但是我会因为以下原因而从cdn主持 not recommend
虽然谷歌CDN与其他人相比你的命中率很高,但它仍然非常低 . (任何cdn不仅仅是谷歌) .
通过cdn加载你将有3个请求,一个用于jQuery.js,一个用于jQueryUI.js,一个用于代码 . 您可能会在本地压缩它并将其作为单个资源加载 .
http://zoompf.com/blog/2010/01/should-you-use-javascript-library-cdns
6 回答
Google AJAX Libraries API包含jQuery UI(目前为v1.10.3),还包含了jQuery UI blog的热门主题:
Google Ajax Libraries 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,和vader .
jQuery现在有一个CDN访问权限:
code.jquery.com/ui/ [version] / themes / [theme name] /jquery-ui.css
为了使这更容易一点,你走了:
base:http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css
黑色领带:http://code.jquery.com/ui/1.9.1/themes/black-tie/jquery-ui.css
blitzer:http://code.jquery.com/ui/1.9.1/themes/blitzer/jquery-ui.css
cupertino:http://code.jquery.com/ui/1.9.1/themes/cupertino/jquery-ui.css
dark-hive:http://code.jquery.com/ui/1.9.1/themes/dark-hive/jquery-ui.css
dot-luv:http://code.jquery.com/ui/1.9.1/themes/dot-luv/jquery-ui.css
茄子:http://code.jquery.com/ui/1.9.1/themes/eggplant/jquery-ui.css
激动自行车:http://code.jquery.com/ui/1.9.1/themes/excite-bike/jquery-ui.css
电影:http://code.jquery.com/ui/1.9.1/themes/flick/jquery-ui.css
热偷偷摸摸:http://code.jquery.com/ui/1.9.1/themes/hot-sneaks/jquery-ui.css
人性:http://code.jquery.com/ui/1.9.1/themes/humanity/jquery-ui.css
le-frog:http://code.jquery.com/ui/1.9.1/themes/le-frog/jquery-ui.css
mint-choc:http://code.jquery.com/ui/1.9.1/themes/mint-choc/jquery-ui.css
阴 Cloud 密布:http://code.jquery.com/ui/1.9.1/themes/overcast/jquery-ui.css
pepper-grinder:http://code.jquery.com/ui/1.9.1/themes/pepper-grinder/jquery-ui.css
redmond:http://code.jquery.com/ui/1.9.1/themes/redmond/jquery-ui.css
平滑度:http://code.jquery.com/ui/1.9.1/themes/smoothness/jquery-ui.css
南街:http://code.jquery.com/ui/1.9.1/themes/south-street/jquery-ui.css
开始:http://code.jquery.com/ui/1.9.1/themes/start/jquery-ui.css
晴天:http://code.jquery.com/ui/1.9.1/themes/sunny/jquery-ui.css
swanky-purse:http://code.jquery.com/ui/1.9.1/themes/swanky-purse/jquery-ui.css
trontastic:http://code.jquery.com/ui/1.9.1/themes/trontastic/jquery-ui.css
ui-darkness:http://code.jquery.com/ui/1.9.1/themes/ui-darkness/jquery-ui.css
ui-lightness:http://code.jquery.com/ui/1.9.1/themes/ui-lightness/jquery-ui.css
vader:http://code.jquery.com/ui/1.9.1/themes/vader/jquery-ui.css
Google正在此链接中托管jQueryUI css https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.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
我想是的 . 为什么不?不会有很多CDN没有提供CSS来支持脚本文件
This link表明它们是:
如果你的意思是jQuery UI css,你可以使用这个:
正如奥巴马所说"Yes We Can" . 这是它的链接 . developers.google.com/#jquery
你需要使用
Google
jQuery CDN
Microsoft
在gallery子选项卡中查找主题名称http://jqueryui.com/themeroller/
.
但是我会因为以下原因而从cdn主持 not recommend
虽然谷歌CDN与其他人相比你的命中率很高,但它仍然非常低 . (任何cdn不仅仅是谷歌) .
通过cdn加载你将有3个请求,一个用于jQuery.js,一个用于jQueryUI.js,一个用于代码 . 您可能会在本地压缩它并将其作为单个资源加载 .
http://zoompf.com/blog/2010/01/should-you-use-javascript-library-cdns