Home jquery Working example of displaying Youtube video in FancyBox

Working example of displaying Youtube video in FancyBox

Author

Date

Category

Who can share?

Here is the code I have for displaying a video off-center of the screen, and an iframe 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 & amp; autoplay = 1',
    'width': 640,
    'height': 480,
    helpers: {
      overlay: {
        locked: false
      },
      title: {
        type: 'inside' // to append the html
      }
    }
  });
});

Answer 1, authority 100%

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

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

And in html this is the code:

& lt; a class = "link" href = "http://www.youtube.com/watch?v = video code "data-rel =" media "& gt;
  Watch the video
& lt; / a & gt;

Answer 2, authority 50%

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions