lokesh / lightbox2

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

feat: When displaying SVGs, max out their size #684

Closed lokesh closed 4 years ago

lokesh commented 4 years ago

SVGs are often constructed to be scaled up and down to various sizes, and since SVGs are a primarily vector format, they can be scaled up and down without quality loss. Many of these SVG files are constructed w/o consideration of the viewbox dimensions. Some are tiny, and some are massive. When they are rendered on a site, these intrinsic dimensions don't matter much, as they are almost always resized for the layout context (e.g. svg { width: 100%; }).

How does this affect Lightbox? When using SVGs with Lightbox, we are seeing some files render very tiny. This is because of their small intrinsic dimensions. image

To resolve this issue, when an SVG is loaded in Lightbox, rather than reading the width and height, we max out the image in the viewport.


https://github.com/lokesh/lightbox2/issues/681

@davidc Considering this update to resolve your issue.

davidc commented 4 years ago

Tested & confirmed fixes #681, thank you.