Skip to content

Commit 5210ca2

Browse files
committed
feat: When displaying SVGs, max out their size
1 parent 85dd34f commit 5210ca2

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Lightbox2
22

3-
The original lightbox script. Eight years later — still going strong!
3+
The _original_ lightbox script.
44

55
Lightbox is small javascript library used to overlay images on top of the current page. It's a snap to setup and works on all modern browsers.
66

src/js/lightbox.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -314,18 +314,13 @@
314314
maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - self.options.positionFromTop - 70;
315315

316316
/*
317-
SVGs that don't have width and height attributes specified are reporting width and height
318-
values of 0 in Firefox 47 and IE11 on Windows. To fix, we set the width and height to the max
319-
dimensions for the viewport rather than 0 x 0.
320-
321-
https://github.com/lokesh/lightbox2/issues/552
317+
Since many SVGs have small intrinsic dimensions, but they support scaling
318+
up without quality loss because of their vector format, max out their
319+
size.
322320
*/
323-
324321
if (filetype === 'svg') {
325-
if ((preloader.width === 0) || preloader.height === 0) {
326-
$image.width(maxImageWidth);
327-
$image.height(maxImageHeight);
328-
}
322+
$image.width(maxImageWidth);
323+
$image.height(maxImageHeight);
329324
}
330325

331326
// Fit image inside the viewport.

0 commit comments

Comments
 (0)