lokesh / lightbox2

THE original Lightbox script (v2).
http://lokeshdhakar.com/projects/lightbox2/
MIT License
6.17k stars 1.76k forks source link

Fix too much unused space on mobile, landscape view #640

Closed Zenju closed 5 years ago

Zenju commented 5 years ago

Hi,

lightbox2 is great, I only have a single issue with it, namely too much unused space on mobile, landscape view: landscape issue

In lightbox.js I find the magic number "120" ! maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - 120;

I'm not sure what this is about. I may be wrong, but it seems the only height that needs to be subtracted is the top offset and the "lb-dataContainer" height below the image (45px in my case), thous:

maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - 45 - self.$lightbox[0].offsetTop;

Now, when my site is in mobile mode, I can set #lightbox "top" to 0: ` @media screen and (max-width: 1050px) {

lightbox

{
    top: 0 !important;
}

} `

And everything looks great, with no space wasted: landscape fixed

Zenju commented 5 years ago

This can be closed, pure CSS is the way to go: https://github.com/lokesh/lightbox2/issues/641