生成带有fancybox的缩略图库

时间:2012-02-19 09:54:28

标签: jquery fancybox

首先,抱歉英语不好: - )

在我拥有的一个小网站上,我想使用Fancybox向用户显示带有缩略图的图库。 但是,在打开fancybox的页面上,我没有指向图像的链接。 (因为有很多图像)。

所以,我试过这样的事情:

$(document).ready(function() {              
    $.fancybox(
        [ 
            {href : 'rep/img01.jpg', rel : 'fancybox-thumb', class : 'fancybox-thumb'}, 
            {href : 'rep/img02.jpg', rel : 'fancybox-thumb', class : 'fancybox-thumb'} 
        ],
        {
            type : 'image',
            autoScale : true,
            prevEffect : 'none',
            nextEffect : 'none',
            thumbs: {
                width   : 50,
                height  : 50
            }
        }               
    );
});

它会打开我的画廊,但没有缩略图:-( 希望我很清楚...

1 个答案:

答案 0 :(得分:4)

Thumbs是选项helpers的子选项,因此您的代码应该像

$(document).ready(function () {
    $.fancybox([{
        href: 'rep/img01.jpg',
        rel: 'fancybox-thumb',
        class: 'fancybox-thumb'
    }, {
        href: 'rep/img02.jpg',
        rel: 'fancybox-thumb',
        class: 'fancybox-thumb'
    }], {
        // API options
        type: 'image',
        autoScale: true,
        prevEffect: 'none',
        nextEffect: 'none',
        helpers: {
            thumbs: {
                width: 50,
                height: 50
            } //  thumbs
        } //  helpers
    }); // fancybox
}); // ready