jsor / lity

Lightweight, accessible and responsive lightbox.
https://sorgalla.com/lity/
MIT License
1.16k stars 195 forks source link

Open VideoJs on Click #169

Open westindiantech opened 6 years ago

westindiantech commented 6 years ago

Hi, I've installed and setup lity and it works fine using the data attribute however I want to use lity to open my videos which are displayed in videojs.

How would I do this pragmatically.

I've tried jQuery('.mejs__overlay-play').on('click', '[data-lightbox]', lity);

jsor commented 6 years ago

There are mayn ways to do this including using a custom handler. The easiest way is probably by globally listening to the readyevent.

The following might do it (untested):

$(document).on('lity:ready', function(event, instance) {
    instance.element().find('video').each(function() {
        videojs(this);
    });
});