jQuery Mobile CSS不会从本地加载,只能从Web加载 [英] jquery mobile css does not load from local, only from web

查看:94
本文介绍了jQuery Mobile CSS不会从本地加载,只能从Web加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

必须对此有答案,这让我发疯了!!

Someone must have the answer to this, it's driving me nuts!!!

我正在测试一个jQuery移动页面,并且在index.html页面中包含以下内容:

I am testing a jquery mobile page and have the following in my index.html page:

<link rel="stylesheet" href="css/jquery.mobile-1.2.0.min.css" />
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/jquery.mobile-1.2.0.min.js"></script>

它不起作用.页面无法识别CSS或JS.但是,当我通过网络加载它时,它会起作用:

It doesn't work. The page doesn't recognize the css or js. But when I load it over the network it works:

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>

我已经一遍又一遍地复制并下载了这些文件,以检查我是否具有正确的本地文件.为什么要从外部URL加载而不从本地文件加载?

I've copied and downloaded those files over and over to check that I have the right local files. Why would it load from an external URL but not my local files?

推荐答案

如果项目的根目录中有js文件夹和css文件夹,请添加前导"/".前导斜线将使您从域的开头开始.

If you have a js folder and a css folder in the root of your project add a leading "/". The leading slash will start you at the beginning of the domain.

<link rel="stylesheet" href="/css/jquery.mobile-1.2.0.min.css" />
<script src="/js/jquery-1.8.2.min.js"></script>
<script src="/js/jquery.mobile-1.2.0.min.js"></script>

这篇关于jQuery Mobile CSS不会从本地加载,只能从Web加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆