ASP.net MVC 和 jQueryUI 困境
我刚刚将一个项目移至 ASP.net MVC
框架的测试版,我遇到的唯一问题是 jQuery
和 jQueryUI
。
事情是这样的:
在 Site.Master
中有以下脚本引用:
<script src="../../Scripts/jquery-1.2.6.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui.js" type="text/javascript"></script>
使用这些脚本引用,我在其中一个视图上拥有的 accordian UI
可以完美地工作,除了一个问题:页面中不包含来自 ThemeRoller
的图像。 如果我注释掉 jQuery 引用,ThemeRoller 图像就在那里。 所有 css 都位于 Content 文件夹
中,所有脚本都位于 Scripts 文件夹
中。
我知道这是一个愚蠢的路径问题,但它让我抽搐。
我缺少什么?
更新
我尝试了第一个答案,但没有成功,请阅读评论以了解详细信息。 再次感谢观看的各位。
第二种方法也行不通。 我很困惑。
另一个更新
对脚本使用 Url.Content
标签确实可以让脚本正常运行。 使用样式表的常规标签可以将所有样式添加到页面上,除了所有与 ThemeRoller 相关的样式。
jquery-ui-themeroller.css
文件位于 Content 文件夹中,当我检查元素时,CSS 就存在。 我怀疑问题出在从该 css 文件到 themeroller 的图像文件夹的映射中,该文件夹也位于 Content 文件夹中。 此文件中的图像链接指定为:background: url(images/foo.gif)
此文件中的链接是否需要更改?
I just moved a project to the the beta release of ASP.net MVC
framework and the only problem I am having is with jQuery
and jQueryUI
.
Here's the deal:
In Site.Master
are the following script references:
<script src="../../Scripts/jquery-1.2.6.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui.js" type="text/javascript"></script>
And using those, the accordian UI
that I have on one of the views works perfectly, except for one problem: the images from ThemeRoller
aren't included on the page. If I comment out the jQuery references, the ThemeRoller images are there. All of the css is in the Content folder
and all of the scripts are in the Scripts folder
.
I know this is a silly path problem, but it's making me twitch.
What am I missing?
Update
I tried the first answer to no avail, read the comment for details. Thanks again for those who are viewing.
The second approach is not working either. I'm baffled.
Another Update
Using the Url.Content
tags for the scripts does indeed allow the scripts to run properly. Using a regular tag for the stylesheet gets all of the styles onto the page EXCEPT for all of those related to ThemeRoller.
The jquery-ui-themeroller.css
file is in the Content folder and when I inspect an element, the css is present. I suspect the problem is in the mapping from this css file to the images folder for the themeroller, which is in the Content folder as well. Image links in this file as specified as: background: url(images/foo.gif)
Do the links in this file need to change?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
除非所有视图都处于同一级别,否则您需要使用
Url.Content() http://jvance.com/media/2008/10 /18/UrlContent5.media
Unless all your views are at the same level, you'll need to either use
Url.Content() http://jvance.com/media/2008/10/18/UrlContent5.media
这有帮助吗?
http://forums.asp.net/p/1334947/2690469.aspx
does this help?
http://forums.asp.net/p/1334947/2690469.aspx
您需要更改 jquery-ui-themeroller.css 中的链接以指向图像的当前位置。
例如,您需要更新 css 文件正在查找的图像的路径。
从路径中删除“images/”,使其看起来像:
因为您的 css 和图像都位于内容文件夹中。
You need to change the links in jquery-ui-themeroller.css to point to the current location of the images.
As in, you need to update the path of the images that the css file is looking for.
Remove the 'images/' from your paths to make it look like:
as both your css and images are in the content folder.