jquery-ui.css googleapis与localhost的奇怪行为

时间:2016-11-17 12:16:49

标签: jquery html css local

如果我从谷歌服务器中包含jquery-ui.css,那就太好了。

<link rel="stylesheet" href="ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" >

http://codepen.io/one2gov/pen/jVVrzv

enter image description here

但如果我将其下载到localstorage,它的行为会有所不同 div的位置变得相对。

<link rel="stylesheet" href="css/jquery-ui.css" >

enter image description here

如果我从localhost上的其他在线服务中包含它,那就是同样的事情,

<link rel="stylesheet" href="http://codepen.io/one2gov/pen/oYYzbw.css" >, 

但在网上没有任何问题。

http://codepen.io/one2gov/pen/ZBBppG

我认为这是因为加载速度不同而发生的,但如果有人解释这种行为,我会很感激。

1 个答案:

答案 0 :(得分:0)

可能您使用file://C:/之类的内容,不支持跨源请求。

您可以在本地PC上安装网络服务器,或将其上传到其他地方以支持跨源请求