'How would I open the links in a LIGHTBOX using this code? they will be youtube videos

I would like to open the links on a lightbox as they will be YouTube videos. What should I add to this code? Ideally they would be embedded videos. I'm a noob. Thanksss

<style>.e-gallery-item{cursor: pointer;} </style>

<script>
document.addEventListener('DOMContentLoaded', function () {

var filteredImages = document.querySelectorAll('.e-gallery-item');

//Edit the links HERE
var links = [
'YouTube Link 1',
'YouTube Link 2',
'YouTube Link 3',
];

var _loope = function _loope(i) {
filteredImages[i].addEventListener('click', function () {
location = links[i];
});
};

for (var i = 0; i < filteredImages.length; i++) {
_loope(i);
}

});

</script>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source