New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Close Lightbox Youtube video after has been playes with data-lity #206
Comments
No one? |
I am facing almost same issue. I do want to close the lightbox from inside the iframe (meaning: target parent window to close the iframe). I also read something about opening it programmatically, but not understanding it at all... Thanks for any help |
just played around a bit: opened iframe with
and then tried to close it from inside iframe with
...unfortunately not working. somehow the parent window is not targeted or the opened instance "myLity" is not handed over... |
If I understand your question correctly, you’ll need to listen to the events emitted by the YouTube player within the iframe. Then you’ll be able to detect when the video has finished playing. See here for some examples: https://developers.google.com/youtube/iframe_api_reference#Getting_Started |
It's pretty simple, I've done it with Vimeo using like this (I assume YT has something similar).
|
Here's the Youtube version: HTML
JS
IMPORTANT NOTES
For additional info & samples, read this post. N.B.: If the author is up for it, I wouldn't mind add the Vimeo and Youtube APIs to the corresponding lity plugins to trasform these hacks into lity's legacy functions: drop a note if you're interested :) |
Hi @Darkseal |
Hi Guys,
I've used data-lity method to open the lightbox, like this
<a href="//www.youtube.com/watch?v=XSGBVzeBUbk" data-lity>iFrame Youtube</a>
But I haven't found the way to close the lightbox after the video has been played. Is there any way to get this done? I've seen another example related but only works when the instance is defined on JS.
Cheers guys
The text was updated successfully, but these errors were encountered: