我正在使用这个我非常喜欢的jquery插件(enter link description here),并且演示网站运行完美。但是,当我用我的图像替换图像而不触摸任何代码(我想在自定义之前测试它)时,我收到错误并且图像无法加载。
图库的工作方式如下:您单击缩略图,脚本会根据您在该缩略图的“Alt”标记中放置的内容调用相应的完整尺寸图像。问题是,当我添加我的图像时,我收到此错误:无法加载资源:服务器响应状态为404(未找到)
经过进一步检查,我发现了问题,但不知道如何修复它。 “GET”方法正在寻找“text / html”文件而不是JPEG。我很困惑,因为我无法弄清楚为什么它没有看到我的图像路径作为jpg与原始演示网站。
以下是我的网站:http://secondstoryinteriors.com/lookbook/
我还提供了整个页面的代码。谢谢你的帮助!
<html>
<head>
<title>Sliding Panel Photowall Gallery with jQuery</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="description" content="Sliding Panel Photowall Gallery with jQuery" />
<meta name="keywords" content="jquery, images, gallery, photowall, slideshow"/>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/>
</head>
<style>
a{
color:#262626;
text-decoration:none;
}
a:hover{
text-decoration:underline;
}
span.reference{
position:fixed;
left:30px;
bottom:0px;
font-size:9px;
}
span.reference a{
color:#aaa;
}
span.reference a:hover{
color:#262626;
text-decoration:none;
}
</style>
<body>
<div class="infobar">
<span id="description"></span>
<span id="loading">Loading Image</span>
<span class="reference">
<h2>FALL/WINTER 2013 LOOKBOOK</a>
</span>
</div>
<div id="thumbsWrapper">
<div id="content" >
<img src="thumbs/1.jpg" alt="images/1.jpg" title="Beatriz_Florido_01 © studio.es"/>
<img src="thumbs/2.jpg" alt="images/2.jpg" title="Nuria_09 © studio.es by Vincent Boiteau"/>
<img src="thumbs/3.jpg" alt="images/3.jpg" title="Nuria_08 © studio.es by Vincent Boiteau"/>
<img src="thumbs/4.jpg" alt="images/4.jpg" title="Nuria_07 © studio.es by Vincent Boiteau"/>
<img src="thumbs/5.jpg" alt="images/5.jpg" title="Nuria_06 © studio.es by Vincent Boiteau"/>
<img src="thumbs/6.jpg" alt="images/6.jpg" title="Nuria_05 © studio.es by Vincent Boiteau"/>
<img src="thumbs/7.jpg" alt="images/7.jpg" title="Nuria_04 © studio.es by Vincent Boiteau"/>
<img src="thumbs/8.jpg" alt="images/8.jpg" title="Nuria_03 © studio.es by Vincent Boiteau"/>
<img src="thumbs/9.jpg" alt="images/9.jpg" title="Nuria_02 © studio.es by Vincent Boiteau"/>
<img src="thumbs/10.jpg" alt="images/10.jpg" title="Nuria_01 © studio.es by Vincent Boiteau"/>
<img src="thumbs/11.jpg" alt="images/11.jpg" title="Janne_Nielsen_07 © studio.es by Vincent Boiteau"/>
<img src="thumbs/12.jpg" alt="images/12.jpg" title="Janne_Nielsen_03 © studio.es by Vincent Boiteau"/>
<img src="thumbs/13.jpg" alt="images/13.jpg" title="Janne_Nielsen_06 © studio.es by Vincent Boiteau"/>
<img src="thumbs/14.jpg" alt="images/14.jpg" title="Janne_Nielsen_05 © studio.es by Vincent Boiteau"/>
<img src="thumbs/15.jpg" alt="images/15.jpg" title="Janne_Nielsen_04 © studio.es by Vincent Boiteau"/>
<img src="thumbs/16.jpg" alt="images/16.jpg" title="Janne_Nielsen_01 © studio.es by Vincent Boiteau"/>
<img src="thumbs/17.jpg" alt="images/17.jpg" title="Beatriz_Ruiz_10 © studio.es by Vincent Boiteau"/>
<img src="thumbs/18.jpg" alt="images/18.jpg" title="Beatriz_Ruiz_08 © studio.es by Vincent Boiteau"/>
<img src="thumbs/19.jpg" alt="images/19.jpg" title="Beatriz_Ruiz_06 © studio.es by Vincent Boiteau"/>
<img src="thumbs/20.jpg" alt="images/20.jpg" title="Beatriz_Ruiz_05 © studio.es by Vincent Boiteau"/>
<img src="thumbs/21.jpg" alt="images/21.jpg" title="Beatriz_Ruiz_04 © studio.es by Vincent Boiteau"/>
<img src="thumbs/22.jpg" alt="images/22.jpg" title="Beatriz_Ruiz_02 © studio.es by Vincent Boiteau"/>
<img src="thumbs/23.jpg" alt="images/23.jpg" title="Beatriz_Ruiz_01 © studio.es by Vincent Boiteau"/>
<img src="thumbs/24.jpg" alt="images/24.jpg" title="Fashion 9 © studio.es by Vincent Boiteau"/>
<div class="placeholder"></div>
</div>
</div>
<div id="panel">
<div id="wrapper">
<a id="prev"></a>
<a id="next"></a>
</div>
</div>
<!-- The JavaScript -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
/* this is the index of the last clicked picture */
var current = -1;
/* number of pictures */
var totalpictures = $('#content img').size();
/* speed to animate the panel and the thumbs wrapper */
var speed = 500;
/* show the content */
$('#content').show();
/*
when the user resizes the browser window,
the size of the picture being viewed is recalculated;
*/
$(window).bind('resize', function() {
var $picture = $('#wrapper').find('img');
resize($picture);
});
/*
when hovering a thumb, animate it's opacity
for a cool effect;
when clicking on it, we load the corresponding large image;
the source of the large image is stored as
the "alt" attribute of the thumb image
*/
$('#content > img').hover(function () {
var $this = $(this);
$this.stop().animate({'opacity':'1.0'},200);
},function () {
var $this = $(this);
$this.stop().animate({'opacity':'0.4'},200);
}).bind('click',function(){
var $this = $(this);
/* shows the loading icon */
$('#loading').show();
$('<img/>').load(function(){
$('#loading').hide();
if($('#wrapper').find('img').length) return;
current = $this.index();
var $theImage = $(this);
/*
After it's loaded we hide the loading icon
and resize the image, given the window size;
then we append the image to the wrapper
*/
resize($theImage);
$('#wrapper').append($theImage);
/* make its opacity animate */
$theImage.fadeIn(800);
/* and finally slide up the panel */
$('#panel').animate({'height':'100%'},speed,function(){
/*
if the picture has a description,
it's stored in the title attribute of the thumb;
show it if it's not empty
*/
var title = $this.attr('title');
if(title != '')
$('#description').html(title).show();
else
$('#description').empty().hide();
/*
if our picture is the first one,
don't show the "previous button"
for the slideshow navigation;
if our picture is the last one,
don't show the "next button"
for the slideshow navigation
*/
if(current==0)
$('#prev').hide();
else
$('#prev').fadeIn();
if(current==parseInt(totalpictures-1))
$('#next').hide();
else
$('#next').fadeIn();
/*
we set the z-index and height of the thumbs wrapper
to 0, because we want to slide it up afterwards,
when the user clicks the large image
*/
$('#thumbsWrapper').css({'z-index':'0','height':'0px'});
});
}).attr('src', $this.attr('alt'));
});
/*
when hovering a large image,
we want to slide up the thumbs wrapper again,
and reset the panel (like it was initially);
this includes removing the large image element
*/
$('#wrapper > img').live('click',function(){
$this = $(this);
$('#description').empty().hide();
$('#thumbsWrapper').css('z-index','10')
.stop()
.animate({'height':'100%'},speed,function(){
var $theWrapper = $(this);
$('#panel').css('height','0px');
$theWrapper.css('z-index','0');
/*
remove the large image element
and the navigation buttons
*/
$this.remove();
$('#prev').hide();
$('#next').hide();
});
});
/*
when we are viewing a large image,
if we navigate to the right/left we need to know
which image is the corresponding neighbour.
we know the index of the current picture (current),
so we can easily get to the neighbour:
*/
$('#next').bind('click',function(){
var $this = $(this);
var $nextimage = $('#content img:nth-child('+parseInt(current+2)+')');
navigate($nextimage,'right');
});
$('#prev').bind('click',function(){
var $this = $(this);
var $previmage = $('#content img:nth-child('+parseInt(current)+')');
navigate($previmage,'left');
});
/*
given the next or previous image to show,
and the direction, it loads a new image in the panel.
*/
function navigate($nextimage,dir){
/*
if we are at the end/beginning
then there's no next/previous
*/
if(dir=='left' && current==0)
return;
if(dir=='right' && current==parseInt(totalpictures-1))
return;
$('#loading').show();
$('<img/>').load(function(){
var $theImage = $(this);
$('#loading').hide();
$('#description').empty().fadeOut();
$('#wrapper img').stop().fadeOut(500,function(){
var $this = $(this);
$this.remove();
resize($theImage);
$('#wrapper').append($theImage.show());
$theImage.stop().fadeIn(800);
var title = $nextimage.attr('title');
if(title != ''){
$('#description').html(title).show();
}
else
$('#description').empty().hide();
if(current==0)
$('#prev').hide();
else
$('#prev').show();
if(current==parseInt(totalpictures-1))
$('#next').hide();
else
$('#next').show();
});
/*
increase or decrease the current variable
*/
if(dir=='right')
++current;
else if(dir=='left')
--current;
}).attr('src', $nextimage.attr('alt'));
}
/*
resizes an image given the window size,
considering the margin values
*/
function resize($image){
var windowH = $(window).height()-100;
var windowW = $(window).width()-80;
var theImage = new Image();
theImage.src = $image.attr("src");
var imgwidth = theImage.width;
var imgheight = theImage.height;
if((imgwidth > windowW)||(imgheight > windowH)){
if(imgwidth > imgheight){
var newwidth = windowW;
var ratio = imgwidth / windowW;
var newheight = imgheight / ratio;
theImage.height = newheight;
theImage.width= newwidth;
if(newheight>windowH){
var newnewheight = windowH;
var newratio = newheight/windowH;
var newnewwidth =newwidth/newratio;
theImage.width = newnewwidth;
theImage.height= newnewheight;
}
}
else{
var newheight = windowH;
var ratio = imgheight / windowH;
var newwidth = imgwidth / ratio;
theImage.height = newheight;
theImage.width= newwidth;
if(newwidth>windowW){
var newnewwidth = windowW;
var newratio = newwidth/windowW;
var newnewheight =newheight/newratio;
theImage.height = newnewheight;
theImage.width= newnewwidth;
}
}
}
$image.css({'width':theImage.width+'px','height':theImage.height+'px'});
}
});
</script>
</body>
答案 0 :(得分:0)
404意味着没有找到图像,实际上无处可寻......
他们不在根目录或内部lookbook /文件夹,所以他们在哪里?把正确的地址和它会起作用