Answer the question
In order to leave comments, you need to log in
FancyBox + YouTube AutoPlay?
Good day, dear toasters), there is such a problem with a site with wordpress + ninja popup plugin installed, I display a video in the youtube frame with automatic playback, everything works fine, only when the fancybox modal window is closed, the video continues to play, I have already rummaged through everything, not strong in js, but I suspect that it is necessary to carry out some actions with vid.attr('src', ''), with the OnClose action or something like that (or maybe not at all), in general, I can’t understand the second day what to do (((
Ninja popup uses fancyBox -jQuery Plugin * version: 2.1.4
If you need to throw off the script, I really need help, thanks in advance to everyone who responds.
Answer the question
In order to leave comments, you need to log in
If the video is displayed through an iframe, then you can do this:
$(document).ready(function () {
var close = function() {
var player = $('iframe'), video = player.attr("src");
player.attr("src","");
player.attr("src", video);
}
$(document).on('click', '.fancybox-close', function () {
close();
});
});
function close() {
$('#player').get(0).stopVideo();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question