fancybox, open gallery on click

题意:使用 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([

 

 

6d5122792037422da79dcc5824a992aa.jpeg

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

营赢盈英

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值