3

我有一个简单的图片库,用户可以在其中单击缩略图,Fancybox 将打开全尺寸图片。太好了,它有效。现在,我想添加一些自定义 HTML,以便图像包含在底部有标题的包装器中,照片右侧有照片评论(想想 facebook)。我该怎么做呢?我已经尝试了好几个小时来弄清楚如何做到这一点,而我所能做的就是让原始照片用 Fancybox 打开。这是我正在使用的代码:

$(document).ready(function() {
    $(".fancybox-button").fancybox({
        padding     : 0,
        prevEffect  : 'none',
        nextEffect  : 'none',
        closeBtn    : false,
        helpers : { 
            title       : { type : 'inside' },
            buttons     : {}
        }
    });
});

我正在寻找这样的东西(注意最后一行):

$(document).ready(function() {
    $(".fancybox-button").fancybox({
        padding     : 0,
        prevEffect  : 'none',
        nextEffect  : 'none',
        closeBtn    : false,
        helpers : { 
            title       : { type : 'inside' },
            buttons     : {},
            html : {'<div>my custom html</div>'}
        }
    });
});

我该怎么做?

4

3 回答 3

14

在 Fancybox 2 上弹出自定义 HTML:

$.fancybox({ content: '<div>my custom html</div>' });
于 2013-07-19T03:42:09.623 回答
3

看看这个演示

你在找这样的东西吗?

于 2012-07-06T05:18:17.830 回答
1

你说“想想脸书”吗?那么你也可以考虑我的fancybox“a la”Facebook:

http://www.picssel.com/playground/jquery/fancyboxALAfacebook_26Mar12.html

它需要fancybox v2.x

于 2012-07-06T05:46:00.037 回答