From 5210ca2941b980386a1ee86133c25832bf6b5de5 Mon Sep 17 00:00:00 2001 From: Lokesh Dhakar Date: Fri, 3 Jul 2020 20:20:34 -0700 Subject: [PATCH 1/2] feat: When displaying SVGs, max out their size --- README.md | 2 +- src/js/lightbox.js | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7c2ce51c..1595f1ee 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Lightbox2 -The original lightbox script. Eight years later — still going strong! +The _original_ lightbox script. 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. diff --git a/src/js/lightbox.js b/src/js/lightbox.js index 8d8ea06c..22791239 100644 --- a/src/js/lightbox.js +++ b/src/js/lightbox.js @@ -314,18 +314,13 @@ maxImageHeight = windowHeight - self.containerPadding.top - self.containerPadding.bottom - self.imageBorderWidth.top - self.imageBorderWidth.bottom - self.options.positionFromTop - 70; /* - SVGs that don't have width and height attributes specified are reporting width and height - values of 0 in Firefox 47 and IE11 on Windows. To fix, we set the width and height to the max - dimensions for the viewport rather than 0 x 0. - - https://github.com/lokesh/lightbox2/issues/552 + Since many SVGs have small intrinsic dimensions, but they support scaling + up without quality loss because of their vector format, max out their + size. */ - if (filetype === 'svg') { - if ((preloader.width === 0) || preloader.height === 0) { - $image.width(maxImageWidth); - $image.height(maxImageHeight); - } + $image.width(maxImageWidth); + $image.height(maxImageHeight); } // Fit image inside the viewport. From 02eb8eed68bf8ac8ae72066ddc1d76789a46bd12 Mon Sep 17 00:00:00 2001 From: Lokesh Dhakar Date: Mon, 6 Jul 2020 21:59:07 -0700 Subject: [PATCH 2/2] patch version bump --- package.json | 2 +- src/js/lightbox.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4f8cbbfd..ad21f324 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lightbox2", - "version": "2.11.1", + "version": "2.11.2", "author": "Lokesh Dhakar ", "description": "The original Lightbox script. Uses jQuery.", "keywords": [ diff --git a/src/js/lightbox.js b/src/js/lightbox.js index 22791239..aa97e73f 100644 --- a/src/js/lightbox.js +++ b/src/js/lightbox.js @@ -1,5 +1,5 @@ /*! - * Lightbox v2.11.1 + * Lightbox v2.11.2 * by Lokesh Dhakar * * More info: