Answer the question
In order to leave comments, you need to log in
How to stop youtube video when closing modal window?
Please tell me how to stop the video from YouTube in the modal window when the window is closed,
+ the video is in the owl carousel , the modal window is in css.
Answer the question
In order to leave comments, you need to log in
It worked.
What was done:
1. Climbed into the owl carousel script and added enablejsapi=1 and id="Youtube" there so that it would be in the iframe
As a result, the output turned out to be
4 into the div where the carousel stands . I added it to the script
function onYouTubePlayerAPIReady() {
player = new YT.Player('Youtube', {
events: {'onReady': onPlayerReady}
});
}
function onPlayerReady(event) {
document.getElementById("playYoutube").addEventListener("click", function() {player.playVideo();});
document.getElementById("pauseYoutube").addEventListener("click", function() {player.pauseVideo();});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question