题意:使用 fancybox 这个库(或插件),在点击时打开图片画廊
问题背景:
I`m not sure, maybe this question is already answered or there is some similar, but I hope that this will be the easiest way for me, to figure out this problem.
“我不确定,也许这个问题已经得到解答了,或者有一些类似的,但我希望这对我来说将是最简单的方式,来弄清楚这个问题。”
So I have this code in my "head" tag:
“所以我在我的'head'标签中有这样的代码:”
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="js/fancybox/jquery.easing-1.3.pack.js"></script>
<script type="text/javascript" src="js/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<link rel="stylesheet" href="js/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox();
$("#fb_man").click(function() {
$.fancybox.open([
{
href : 'both.jpg',
title : 'My title'
}, {
href : 'front.jpg',
title : '2nd title'
}
], {
helpers : {
thumbs : {
width: 75,
height: 50
}
}
});
});
});
</script>
And this one in my body: “而这是在我的body中:”
<a id="fb_man" href="javascript:;"><img src="img/eyey.png"></a>
I want to open a gallery of 2 images (both.jpg and front.jpg) by clicking on eyey.png, but I get this error:
“我想通过点击eyey.png来打开包含两张图片(both.jpg和front.jpg)的画廊,但我遇到了这个错误:”
Uncaught TypeError: $.fancybox.open is not a function
How can I solve this error? 我怎样解决这个错误?
问题解决:
just change this part from
只需将这部分从
$.fancybox.open([
to 修改成
$.fancybox([