jQueryUI 主题切换器不加载图像
我想稍微玩一下主题切换器,所以我制作了一个简单的页面,只是为了在搞乱它之前看看它是如何工作的。
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"></script>
<script type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.css"></script>
<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
<script>
$(document).ready(function(){
$('#switcher').themeswitcher();
$('#calendar').datepicker();
});
</script>
</head>
<body>
<div id="switcher"></div>
<input type="text" id="calendar"></input>
</body>
</html>
但是页面加载后,我在 Chrome 中打开开发人员工具面板,脚本应该加载的所有图像都抛出 403 禁止错误。这很奇怪,因为我第一次尝试该页面时,切换器 div 就工作了,但我在日期选择器 id 上犯了一个拼写错误,所以我在修复它后重新加载了页面,然后收到了 403 错误。所以我想让它再次工作,但看起来在本地托管所有主题资源并更改主题切换器网址以反映这一点将是一件痛苦的事情;我错过了什么吗?
谢谢
I wanted to play with the themeswitcher a little, so I made a simple page just to see how it worked before messing with it.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"></script>
<script type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.css"></script>
<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
<script>
$(document).ready(function(){
$('#switcher').themeswitcher();
$('#calendar').datepicker();
});
</script>
</head>
<body>
<div id="switcher"></div>
<input type="text" id="calendar"></input>
</body>
</html>
But after the page loads, I opened the developer tools panel in chrome and all the images that the script are supposed to load are throwing 403 forbidden errors. Which is weird because he switcher div worked the very first time I tried the page, but I made a typo on the datepicker id, so I reloaded the page after fixing it and then got 403 errors. So I want to get it working again, but it looks like it would be a pain to locally host all the theme resources and change the themeswitcher urls to reflect that; am I missing something?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不允许热链接到除 code.jquery.com 之外的 jQuery 属性。 http://blog. jquery.com/2010/12/30/hotlinking-to-be-disabled-on-jan-31-2011/
您只需将代码和图像下载到您自己的服务器,然后修改代码以指向您在自己的服务器上下载的图像。
You are not allowed to hotlink to jQuery properties other than code.jquery.com. http://blog.jquery.com/2010/12/30/hotlinking-to-be-disabled-on-jan-31-2011/
you just need to download the code and images to your own server then modify the code to point to the images you downloaded on your own server.
我无法找到在哪里可以下载 jQuery 主题切换器代码,但我确实在 github 上遇到了以下内容 https://github.com/harborhoffer/Super-Theme-Switcher
I was not able to find where you can download the jQuery theme switcher code but I did come across the following on github https://github.com/harborhoffer/Super-Theme-Switcher
详细说明泰勒斯的回答:
我有类似的错误,所以我从 http://jqueryui.com/themeroller/ 下载了js themeswitchertool/,将其保存为 jquery.themeswitcher.js 并将所有 http jquery-ui url 替换为 google apis https url。
唯一的变化是在 var switcherpane 中,其中每个链接如下所示:
我将其替换为:
如果您搜索该文件,则会进一步向下引用一些其他 html 图像。
您可以在此处找到所有图片
To elaborate on Tylers answer:
I had similar errors so I downloaded the js from http://jqueryui.com/themeroller/themeswitchertool/, saved it as jquery.themeswitcher.js and replaced all http jquery-ui urls with google apis https urls.
The only changes were in the var switcherpane where each link looks like:
Which I replaced with:
If you search through the file there are a few other html images that are referenced further down.
You can find all the images here