Streaming live at 10am (PST)

Close lightbox at the end of videos


#1

Hey,

So I have a lightbox with a vimeo and was wondering if it was possible either through custom code or (ideally) native to close a lightbox when the video ends... @cyberdave it would be great to hear your thoughts on this.

If it is not possible I will add it to the wishlist woo smile

Thanks,

Arthur


Autoplay Video in Lightbox (without using default webflow video lightbox)
#2

Something like this would need be done with custom code. Something like when the Vimeo player notices that the video is finished, it'll fire an event those could close a webflow modal.

Here is the JS API for Vimeo, maybe this will lead you in the right direction:
https://developer.vimeo.com/player/js-api#events

good luck and have fun smile


#3

Thanks @PixelGeek I had taken a look at that, do you know what trigger would close the mobile in webflow? I could export a lightbox site and trawl through the js but would probably miss it, if you happen to know let me know. smile

Arthur


#5

A quick hack is to just trigger the event assigned to the close icon:

$('.w-lightbox-control.w-lightbox-close').trigger('tap')

For more details, you'll need to beautify the source code (@danro mentioned in another thread that it was not minified aside from third-party libs, but I must be blind!), and then look for the function createLightbox().

To trigger that after your video is done, you'd listen for the finish event via the Vimeo API:

document.getElementById('vimeo_player').api_addEventListener('finish', function(event) {
$('.w-lightbox-control.w-lightbox-close').trigger('tap');
});

HTH.

-Dave


#6

Thanks @cyberdave @dkenzik, I will play around with the options on this!

Arthur


#7

Has anyone had any luck implementing how to close a lightbox after a video has ended?


#8

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.