Fancybox v2覆盖/格式标题 [英] Fancybox v2 override/format title

查看:69
本文介绍了Fancybox v2覆盖/格式标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何覆盖新版花式框中的标题?

How can i override the Title in the new version of fancy box?

$(document).ready(function() {
    $(".photogalleryLightbox li a").fancybox({
        helpers:{ 
                    title: {
                        type: 'inside',
                        beforeShow: function(opts)
                                    {
                                        console.log('beforeShow title helper');
                                    },
                        },
                    buttons : {}
                },
        beforeShow: function()
        {
            console.log('beforeShow');
            // var obj = $(currentArray[currentIndex]); // from prev. version
            // if (obj.next().length) return obj.next().html(); // from prev. version
        }
    });
});

我试过这个,但不知道如何将变量作为索引。

I tried this but don't know how to get the variables as index.

推荐答案

您可以使用回调来更新标题,例如:

You can use callbacks to update title, example:

$(".photogalleryLightbox li a").fancybox({
        beforeLoad : function() {
            this.title = 'My Custom Title';
        },
        helpers: { 
            title: {
                type: 'inside',
                beforeShow: function(opts) {
                    console.log('beforeShow title helper');
                },
            },
            buttons : {}
        },
        beforeShow: function() {
            console.log('beforeShow');
            // var obj = $(currentArray[currentIndex]); // from prev. version
            // if (obj.next().length) return obj.next().html(); // from prev. version
        }
    });

这篇关于Fancybox v2覆盖/格式标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆