4

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.

gabemartinez
  • 43
  • 1
  • 3
  • 5

1 Answers1

13

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/

PhearOfRayne
  • 4,990
  • 3
  • 31
  • 44
  • Yes sir, I have. And that works fine with images. Just attempting to have a YouTube link or a swf that is hosted by us load instead. – gabemartinez Dec 19 '12 at 08:18
  • 3
    Steven, you are a beast! Thank you very much. I also want to thank Calvin for the help and his suggestion did work, I just wanted to use the fancybox.open. Much appreciated, all. – gabemartinez Dec 19 '12 at 08:37
  • Just in case anyone was looking for the working example of this fancyBox YouTube popup: http://houstonfootballstadium.com/home/ – gabemartinez Dec 19 '12 at 21:55