Closed Pilchard123 closed 5 years ago
Here's a patch that fixes it. This is against 2.10.0 source, but I have only tested it on 2.9.0. The culprit is that some svgs report 0x0 size, so we just display them with maximum size. lightbox-fix-for-0-size-svgs.zip Github doesn't allow attaching *.patch files? How strange.
Fixed in v2.11.0: https://github.com/lokesh/lightbox2/releases/tag/v2.11.0
Some SVG files will open fine in a lightbox; others will collapse to a 0x0 image. I'm not sure what it is that makes the difference, but it may be related to viewbox or height/width attributes in the SVG itself. The behaviour does not seem to be consistent across browsers. In the example below, Firefox 49 and IE11 will collapse the left image, IE collapses both, and Chrome 53 and 54 work fine. I have not tested in other browsers.
Lightbox version: 2.9.0 Reproduced in:
To reproduce:
Example: https://jsfiddle.net/Lj7cfnkL/9/ . The left-hand image is SVG and does not work as expected. The centre image is SVG and does work as expected. The right-hand image is PNG.