electerious / basicLightbox

The lightest lightbox ever made.
https://basiclightbox.electerious.com
MIT License
564 stars 55 forks source link

Iframe responsiveness #22

Closed kalmerrautam closed 6 years ago

kalmerrautam commented 6 years ago

When Youtube/Vimeo video Iframe is placed in inline html: https://jsfiddle.net/kalmerrautam/hmynv9qe/1/ video inside BasicLightbox doesn't scale while narrowing browser window.

Somehow it works perfectly while video ise placed in init script: https://jsfiddle.net/kalmerrautam/138td6mk/

electerious commented 6 years ago

It's because of const html = target.outerHTML. This will place the whole div.lightbox in the lightbox instead of just the video. You can change it to const html = target.innerHTML.

I highly recommend to try the new version and demos of basicLightbox. Using DOM elements is now a lot easier. No getTarget helper required. Just pass the Node to the lightbox.