Skip to content

Commit 7734213

Browse files
authored
Merge pull request #684 from lokesh/dev
feat: When displaying SVGs, max out their size
2 parents 85dd34f + 02eb8ee commit 7734213

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lightbox2",
3-
"version": "2.11.1",
3+
"version": "2.11.2",
44
"author": "Lokesh Dhakar <[email protected]>",
55
"description": "The original Lightbox script. Uses jQuery.",
66
"keywords": [

src/js/lightbox.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Lightbox v2.11.1
2+
* Lightbox v2.11.2
33
* by Lokesh Dhakar
44
*
55
* More info:
@@ -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)