I hope someone can help me with some wisdom or a piece of custom code with a small problem I have with an Youtube Video in one Webflow site I built.
In my case I am using a Youtube Video Widget from Webflow which is embedded in div which acts as some sort of lightbox dark background.
My problem is, that, if the user closes this “video lightbox” while the video is still playing, then it keeps on playing resulting in a weird background sound that can be heard even though the video can not be seen anymore on the page.
I am using the standard Webflow Animation feature for opening and closing my custom lightbox. Unfortunately Webflow Animations don’t have any features to manipulate videoplayback, which is what I need.
The video should be paused when closing the lightbox div containter and not keep on playing.
$(document).ready(function() {
// set unique id to videoplayer for the Webflow video element
var src = $('.youtube-video-wrapper').find('iframe').attr('src');
// when object with class open-popup is clicked...
$('.button.video').click(function(e) {
e.preventDefault();
// change the src value of the video
$('.youtube-video-wrapper').find('iframe').attr('src', src);
});
// when object with class close-popup is clicked...
$('.lightbox-close-icon').click(function(e) {
e.preventDefault();
$('.youtube-video-wrapper').find('iframe').attr('src', '');
});
});
A question I am curious about, how will you do the translations?
let me know if you need more help ping me on Discord “mati#9475”
Regarding translation I was planning to use weglot
But I also saw one example from Ran Segal on Youtube who showed how translation is done via Google translate.
So I am not sure which way to go.