【问题标题】:Fancybox iframe title linkFancybox iframe 标题链接
【发布时间】:2013-04-30 12:35:36
【问题描述】:

我有问题。我有一个页面http://www.hmaloha.com/bionutrient.php,当单击播放按钮时,视频会在fancybox iframe 上播放,并且在视频加载时徽标位于顶部。现在我需要添加一个指向该徽标的链接。我一直在尝试更改fancybox 代码,但没有运气。有什么帮助吗?

$(document).ready(function(){
            $('#malohaStory').click(function(){
                $.fancybox({
                    overlayOpacity: 1,
                    overlayColor: '#bbb',
                    padding : 0,
                    autoScale : false,
                    transitionIn : 'none',
                    transitionOut : 'none',
                    titleShow : true,
                    titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
                    titleFormat : function(){
                        return ' ';
                    },
                    type: 'iframe',
                    href: 'http://hmaloha.com/js/flowplayer/video/index.html',
                    height: 545,
                    width: 920,
                    swf : {
                        wmode : 'transparent',
                        allowfullscreen : 'true'
                    }
                });
                return false;
            });


        });

【问题讨论】:

  • 我猜你已经把它整理好了,不是吗?

标签: jquery iframe fancybox


【解决方案1】:

在您的$.fancybox() 调用中,包括如下所示的beforeLoad 方法,将我的示例链接更改为您的url

beforeLoad: function() {
  this.title = '<a href="http://www.example.com/link.html">' + this.title + '</a>';
}

所以你的最终代码(如果你保留上面的所有内容,虽然我不知道你的 titleFormat 函数在做什么)看起来像这样:

$(document).ready(function(){
        $('#malohaStory').click(function(){
            $.fancybox({
                overlayOpacity: 1,
                overlayColor: '#bbb',
                padding : 0,
                autoScale : false,
                transitionIn : 'none',
                transitionOut : 'none',
                titleShow : true,
                titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
                titleFormat : function(){
                    return '&nbsp;';
                },
                type: 'iframe',
                href: 'http://hmaloha.com/js/flowplayer/video/index.html',
                height: 545,
                width: 920,
                swf : {
                    wmode : 'transparent',
                    allowfullscreen : 'true'
                }
                beforeLoad: function() {
                  this.title = '<a href="http://www.example.com/link.html">' + this.title + '</a>';
                }
            });
            return false;
        });


    });

【讨论】:

  • 我不认为这有帮助,因为beforeLoad 是一个花哨的 v2.x 回调,但 OP 使用的是 v1.3.4。 v2.x 中的 API 选项是新的,与以前的版本不兼容。
猜你喜欢
  • 2021-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-31
  • 1970-01-01
  • 2013-08-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多