jQuery 你能解释一下 $.fancybox.open( [group], [options] ) params 以及我是否可以将 youtube 链接添加为 href 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13948019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 13:07:30  来源:igfitidea点击:

Can you explain $.fancybox.open( [group], [options] ) params and if I can add youtube link as href?

jqueryfancyboxfancybox-2

提问by gabemartinez

I'm reading documentation:

我正在阅读文档:

http://fancyapps.com/fancybox/#docs

http://fancyapps.com/fancybox/#docs

and the $.fancybox.open( [group], [options] ) and open explanation is good, but I'm wondering if I can use a link to a youtube video in the group array? I'm attempting to play a youtube video after the dom is ready such as this:

和 $.fancybox.open( [group], [options] ) 和 open 解释很好,但我想知道我是否可以在组数组中使用指向 youtube 视频的链接?我正在尝试在 dom 准备好后播放 youtube 视频,例如:

http://jsfiddle.net/STgGM/

http://jsfiddle.net/STgGM/

$.fancybox.open([
    {
        href : 'http://fancyapps.com/fancybox/demo/1_b.jpg',
        title : '1st title'
    },
    {
        href : 'http://fancyapps.com/fancybox/demo/2_b.jpg',
        title : '2nd title'
    }    
], {
    padding : 0   
});

I am able to get my video to appear in a fancybox, which is great, but I want it to appear after the page loads automatically without the need to click on a link, such as the fancybox does in the jsfiddle example above with .open.

我能够让我的视频出现在fancybox中,这很棒,但我希望它在页面自动加载后显示而无需单击链接,例如fancybox在上面的jsfiddle示例中使用.open .

Thank you for all of your help in advance.

提前感谢您的所有帮助。

回答by PhearOfRayne

Have you tried doing this yet?

你试过这样做吗?

$(function () {
    $.fancybox.open([
        {
            type: 'iframe',
            href : 'http://www.youtube.com/embed/L9szn1QQfas?autoplay=1&wmode=opaque',                
            title : '1st title'
        }
    ], {
        padding : 0
    });
});

Working Example: http://jsfiddle.net/NDM5F/

工作示例:http: //jsfiddle.net/NDM5F/