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

自作多情 提交于 2019-12-01 04:16:40

问题


I'm reading documentation:

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:

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.

Thank you for all of your help in advance.


回答1:


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/



来源:https://stackoverflow.com/questions/13948019/can-you-explain-fancybox-open-group-options-params-and-if-i-can-add-yo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!