The Gallery
Select a menu option to display a list of thumb nails.
我真的坚持这个,我的代码在Localhost上工作正常,但在Fasthosts服务器上没有,它似乎是对服务器上的文件夹的某种访问问题,这里是调试消息.
GET (http://reggarockaboogie.co.uk/images/gallery/fld01/) 403 (Forbidden) k.cors.a.crossDomain.send @ jquery.min.js:4 n.extend.ajax @ jquery.min.js:4 LoadGallery @ gallery.html:95 (anonymous function) @ gallery.html:86 j @ jquery.min.js:2 k.fireWith @ jquery.min.js:2 n.extend.ready @ jquery.min.js:2 I @ jquery.min.js:2
这是我的代码,
< script >
$(document).ready(function() {
LoadGallery($('a[data-albumid]:first').data('albumid'));
$("a").click(function() {
var dir_path = $(this).data("albumid");
LoadGallery(dir_path);
return false;
});
});
function LoadGallery(dir_path) {
$.ajax({
url: dir_path,
success: function(data) {
$(".image-container").empty();
$(data).find("a:contains(.jpg), a:contains(.png), a:contains(.jpeg)").each(function() {
this.href.replace(window.location.host, "").replace("http:///", "");
var file = dir_path + $(this).text();
$(".image-container").append($(""));
if ($(".image-container").children("a").length === 30) {
return false;
}
});
$(".image-container").append("Click on a thumb nail to show a larger image.
");
$(".thumb").bind('click', function() {
var Popup = "" + "" + "Close";
var Img = $(this).attr("data-src");
$("body").prepend(Popup);
$(".bg").height($(window).height() * 4);
$(".wrapper img").attr("src", Img);
$(".prev-image").bind('click', function() {
var prev = $(".image-container").find("img[src='" + Img + "']").parent().prev('a').find("img").attr('src');
if (!prev || prev.length === 0)
return false;
else {
$(".wrapper img").attr("src", prev);
Img = prev;
}
});
$(".next-image").bind('click', function() {
var next = $(".image-container").find("img[src='" + Img + "']").parent().next('a').find("img").attr('src');
if (!next || next.length === 0)
return false;
else {
$(".wrapper img").attr("src", next);
Img = next;
}
});
$(".close").bind('click', function() {
$(this).siblings("img").attr("src", "")
.closest(".wrapper").remove();
$(".bg").remove();
});
});
}
});
}; < /script>
@import url(http://fonts.googleapis.com/css?family=Varela+Round);
#nav {
float: left;
width: 20px;
margin: 10px 10px 20px 0px;
}
#nav, #nav ul {
list-style: none;
padding: 0;
}
#nav a {
position: relative;
display: block;
width: 105px;
padding-left: 10px;
margin: 3px 0;
text-decoration: none;
font-family: Geneva, Arial, Helvetica, sans-serif;
font-variant: small-caps;
font-weight: bold;
color: #fff;
}
#nav a:link, #nav a:visited {
border-left: #00425E solid 10px;
color: #fff;
}
#nav a:hover, #nav a:active {
border-left-color: #fff;
background-color: #770709;
color: #fff;
}
#nav a#here {
border-left-color: #fff;
background-color: transparent;
color: #fff;
}
#nav ul {
margin-left: 20px;
}
#nav ul a {
width: 50px;
color: #fff;
}
.image-container {
padding-top: 50px;
}
.image-container img {
background-color: white;
border: 4px solid #444;
box-shadow: 0 0 5px #222;
padding: 3px;
margin-top: 10px;
height: auto;
width: auto;
max-width: 100px;
max-height: 100px;
transition: all .7s ease-in-out;
}
.image-container img:hover {
border: 4px solid #888;
cursor: zoom-in;
}
.bg {
background-color: #333;
filter: alpha(opacity=70);
left: 0;
opacity: 0.7;
position: fixed;
top: 0;
width: 100%;
z-index: 1000;
}
.wrapper {
background-color: white;
border: 3px solid #444;
box-shadow: 0 0 5px #222;
padding: 3px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1001;
}
.wrapper .next-image {
position: absolute;
font-size: 2.8em;
top: 50%;
color: #999;
width: 45px;
line-height: 30px;
text-align: center;
height: 45px;
border-radius: 100%;
opacity: 0.7;
filter: alpha(opacity=40); /* For IE8 and earlier */
right: 10px;
left: auto;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.wrapper .prev-image {
position: absolute;
font-size: 2.8em;
top: 50%;
color: #999;
width: 45px;
line-height: 30px;
text-align: center;
height: 45px;
border-radius: 100%;
opacity: 0.7;
filter: alpha(opacity=40); /* For IE8 and earlier */
left: 10px;
right: auto;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.wrapper .prev-image:hover {
border: 2px solid #ccc;
cursor: pointer;
opacity: 1;
}
.wrapper .next-image:hover {
border: 2px solid #ccc;
cursor: pointer;
opacity: 1;
}
.close {
background: transparent url(../gallery/close.png) no-repeat;
height: 32px;
position: absolute;
right: -16px;
text-indent: -9999px;
top: -16px;
width: 32px;
}
1> Quentin..:
该URL返回403错误; 这根本与您的客户端代码无关.
最可能的原因是:
禁用自动生成的目录列表(这需要更改服务器配置,例如对于Apache:indices 选项).
服务器上的目录具有文件权限设置,使得Web服务器软件运行的用户无法读取它(通常使用chmod更改)
推荐阅读
-
如何解决《如何在Windows764位上创建本地多节点Cassandra集群?》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《MongoDBC#驱动程序超时》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《在PL/SQL中转义下划线》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《数据结构:在此类练习中解释pop,push,dequeue,enqueue》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《htmlmailto不发送电子邮件》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《window.navigator.userAgent真的会被弃用吗?》经验,为你挑选了0个好方法。 ...
[详细]
-
如何解决《在ReactNative中动态更改图像URL》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《禁用ac#console的最大化和最小化按钮》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《如何通过CancellationToken停止异步处理?》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《如何在.gdbinit中指定silent/quiet》经验,为你挑选了2个好方法。 ...
[详细]
-
如何解决《无法在AndroidStudio中更新JDK位置》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《在相同片段的不同实例之间进行通信》经验,为你挑选了2个好方法。 ...
[详细]
-
如何解决《C++11如何通过int值获取枚举类值?》经验,为你挑选了2个好方法。 ...
[详细]
-
如何解决《安装和注册shell扩展上下文菜单来自wix安装程序》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《如何使用retofit2和RxAndroid取消请求》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《为什么非conststd::array::operator[]不是constexpr?》经验,为你挑选了3个好方法。 ...
[详细]
-
如何解决《如何使用CSS水平居中链接元素?》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《更改字符时拆分字符串》经验,为你挑选了2个好方法。 ...
[详细]
-
如何解决《PEAR和Composer有什么区别?》经验,为你挑选了1个好方法。 ...
[详细]
-
如何解决《哪一个是有效的初始化变量ie)构造函数或激活方法?》经验,为你挑选了1个好方法。 ...
[详细]
吐了个 "CAO" !
Tags | 热门标签
RankList | 热门文章
-
1检查数组中的所有值是否以字符串开头
-
2在Bootstrap表单上甚至触及表单之前,AngularJS ng-messages显示错误
-
3Python 3.3.5浮点格式精度
-
4如何解决此构建问题 - 无法分配给属性:'date'是一个get get属性
-
5从Azure API管理调用时X-ARR-ClientCert标头中没有证书
-
6Apache Flink中的全局排序
-
7绘制分类热图保持(x,y)值颜色
-
8在javascript中获取对象而不是数组
-
9括号内有多行
-
10Java Regex双反斜杠转义特殊字符
-
11通过api查询npmjs注册表
-
12如何通过GCDWebServer在iOS上播放本地M3u8文件
-
13如果汇编存在,则为C#条件编译
-
14如何评论区域内的所有行
-
15防止onmouseout触发子元素
-
16gem install git-up不再在El Capitan工作
-
17我如何使用或设置sonar-project.properties文件
-
18ScriptedSandbox64.exe已停止工作 - Visual Studio 2015
-
19angular ui bootstrap uib-tooltip show on custom trigger
-
20为什么BigInteger在C#中是一个结构,如果它有一个无限大小?
DevBox开发工具箱 | 专业的在线开发工具网站 京公网安备 11010802040832号 | 京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有