Working example of displaying a Youtube video in FancyBox

Who can share?

Here is the code I have displays the video not in the center of the screen, and the iframe of the video without dimensions:

getVideo(id, function (response) {
    $.fancybox({
        // hide the related video suggestions and autoplay the video
        //'href' : this.href.replace(new RegExp('watch\\?v=', 'i'), 'embed/') + '?rel=0&autoplay=1',
        'width' : 640,
        'height' : 480,

        helpers: {
            overlay: {
                locked: false
            },
            title: {
                type: 'inside' // to append the html
            }
        }
    });
});
Author: Nicolas Chabanovsky, 2014-11-22

2 answers

For the video to work correctly, you need to add helper - media, I have it enabled like this:

$('.link').fancybox({
        openEffect  : 'none',
        closeEffect : 'none',
        helpers : {
            media : {}
        }
    });

And in html here is the code:

<a class="link" href="http://www.youtube.com/watch?v=код видео" data-rel="media">
    Смотреть видео
</a>
 2
Author: MasterAlex, 2014-11-22 18:06:53

Http://fancybox.net/blog The item with the number 4 (the items there are listed in reverse order) Show youtube clips. Try now.

 1
Author: Get, 2014-11-22 18:03:43