lokesh / lightbox2

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

Image resizing issue #740

Open ironfrown opened 9 months ago

ironfrown commented 9 months ago

Lightbox2 2.11.4 on Chrome+Firefox / Ubuntu 22.04

If an image does not fit the viewport, LB2 is checking which dimension is offending and fixes it. However, after resizing the other dimension may still be too large to fit in a viewport, requiring scrolling.

To reproduce, take any horizontal image larger than the browser window and reduce the browser height significantly, LM2 will fit the width but the height will be clipped.

Attached below - web page before and after image click. LM2_before LM2_after

faisalnjs commented 9 months ago

I would say just use CSS to fix this easily, but sizing is definitely an issue I too encountered when using Lightbox 2, and it should be fixed. Small images need to enlarge (>= 75% of screen height) and large images need to shrink (>= 75% of screen height). Below is the CSS override I'm using.

.lb-outerContainer {
    width: 90vw !important;
}

.lightbox .lb-image {
    width: 100% !important;
    height: unset !important;
}