Javascript jQuery照片库插件
我不明白如果我想显示电脑中的图像,我怎么能使用这个插件 但我什么也看不见Javascript jQuery照片库插件,javascript,jquery,image,jquery-plugins,Javascript,Jquery,Image,Jquery Plugins,我不明白如果我想显示电脑中的图像,我怎么能使用这个插件 但我什么也看不见 如何解决该问题?创建文件夹img,将所有img移动到该文件夹,并添加路径,如下代码所示。确保图像名称正确 <!DOCTYPE html> <html> <head> <script type="text/javascript" src="jquery-1.11.1.min.js"></script> <script type="text
如何解决该问题?创建文件夹img,将所有img移动到该文件夹,并添加路径,如下代码所示。确保图像名称正确
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="jquery-photowall.js"></script>
<link rel="stylesheet" type="text/css" href="jquery-photowall.css">
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
PhotoWall.init({
el: '#gallery' // Gallery element
,zoom: true // Use zoom
,zoomAction: 'mouseenter' // Zoom on action
,zoomTimeout: 500 // Timeout before zoom
,zoomDuration: 100 // Zoom duration time
,showBox: true // Enavle fullscreen mode
,showBoxSocial: true // Show social buttons
,padding: 10 // padding between images in gallery
,lineMaxHeight: 150 // Max set height of pictures line
// (may be little bigger due to resize to fit line)
});
/*
Photo object consist of:
{ // big image src,width,height and also image id
id:
,img: //src
,width:
,height:
,th:{
src: //normal thumbnail src
zoom_src: //zoomed normal thumbnail src
zoom_factor: // factor of image zoom
,width: //width of normal thumbnail
,height: //height of normal thumbnail
}
};
*/
var PhotosArray = new Array(
{id:id,img:'img/my_img1.jpg',width:500,height:400,
th:{src:'img/my_img1.jpg',width:50,height:40,
zoom_src:'img/my_img1.jpg',zoom_factor:4
}
},
{id:id,img:'img/my_img2.jpg',width:500,height:400,
th:{src:'img/my_img2.jpg',width:50,height:40,
zoom_src:'img/my_img2.jpg',zoom_factor:4
}
},
{id:id,img:'img/my_img3.jpg',width:500,height:400,
th:{src:'img/my_img3.jpg',width:50,height:40,
zoom_src:'img/my_img3.jpg',zoom_factor:4
}
},
{id:id,img:'my_img4.jpg',width:500,height:400,
th:{src:'my_img4.jpg',width:50,height:40,
zoom_src:'my_img4.jpg',zoom_factor:4
}
}
);
PhotoWall.load(PhotosArray);
});
</script>
<div id="gallery">
<div class="body"></div>
</div>
</body>
</html>
你检查过浏览器控制台是否有错误吗?你需要图像的绝对路径src:'image folder/my_img1.jpg'所有图像都在这个index.html文件的确切文件夹中,只是为了测试,请使用较旧版本的jQuery(如1.7.1)尝试脚本,看看是否有效:你尝试过这段代码吗?因为即使我把所有的图像放在一个文件夹中,并添加一个路径,它也不会工作,我也不会用它来测试。尝试使用上面的演示获取想法
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="jquery-photowall.js"></script>
<link rel="stylesheet" type="text/css" href="jquery-photowall.css">
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
PhotoWall.init({
el: '#gallery' // Gallery element
,zoom: true // Use zoom
,zoomAction: 'mouseenter' // Zoom on action
,zoomTimeout: 500 // Timeout before zoom
,zoomDuration: 100 // Zoom duration time
,showBox: true // Enavle fullscreen mode
,showBoxSocial: true // Show social buttons
,padding: 10 // padding between images in gallery
,lineMaxHeight: 150 // Max set height of pictures line
// (may be little bigger due to resize to fit line)
});
/*
Photo object consist of:
{ // big image src,width,height and also image id
id:
,img: //src
,width:
,height:
,th:{
src: //normal thumbnail src
zoom_src: //zoomed normal thumbnail src
zoom_factor: // factor of image zoom
,width: //width of normal thumbnail
,height: //height of normal thumbnail
}
};
*/
var PhotosArray = new Array(
{id:id,img:'img/my_img1.jpg',width:500,height:400,
th:{src:'img/my_img1.jpg',width:50,height:40,
zoom_src:'img/my_img1.jpg',zoom_factor:4
}
},
{id:id,img:'img/my_img2.jpg',width:500,height:400,
th:{src:'img/my_img2.jpg',width:50,height:40,
zoom_src:'img/my_img2.jpg',zoom_factor:4
}
},
{id:id,img:'img/my_img3.jpg',width:500,height:400,
th:{src:'img/my_img3.jpg',width:50,height:40,
zoom_src:'img/my_img3.jpg',zoom_factor:4
}
},
{id:id,img:'my_img4.jpg',width:500,height:400,
th:{src:'my_img4.jpg',width:50,height:40,
zoom_src:'my_img4.jpg',zoom_factor:4
}
}
);
PhotoWall.load(PhotosArray);
});
</script>
<div id="gallery">
<div class="body"></div>
</div>
</body>
</html>