A simple way to open YouTube videos in jQuery Fancybox
It can be done in a very simple way. The option type needs be defined as iframe.
Here is an example where we get all the links with the "youtube-video" class and apply Fancybox to them. When clicking these links the lightbox with a video will open and the link to video will be taken from the attribute href of the current link.
Watch out! The link should be taken from an "embed" type of the share section on YouTube.
HTML:
<a href="http://www.youtube.com/embed/Xzk_U9E9jQU?autoplay=1" class="youtube-video">Open video in lightbox</a>
JavaScript:
jQuery( 'a.youtube-video' ).fancybox({ type: 'iframe' });