summaryrefslogtreecommitdiff
path: root/_includes/extensions/photo-swipe.html
diff options
context:
space:
mode:
authorJeffrey Tse <jeffreytse.mail@gmail.com>2023-06-28 17:56:56 +0800
committerJeffrey Tse <jeffreytse.mail@gmail.com>2023-06-28 17:56:56 +0800
commit5799ef60383e4bd2378cd716b43e7718d3c09c1c (patch)
tree0b568ff94f6c87f476d6493963ed739c316c45f5 /_includes/extensions/photo-swipe.html
parent3c6242fd02f2e4d2fa30fd4c17c10c61636a7e86 (diff)
fix: image previewer was corrupted by size unit (#114)
When we set img attribute with unit (e.g. width="100px"), it will be corrupted.
Diffstat (limited to '_includes/extensions/photo-swipe.html')
-rw-r--r--_includes/extensions/photo-swipe.html5
1 files changed, 2 insertions, 3 deletions
diff --git a/_includes/extensions/photo-swipe.html b/_includes/extensions/photo-swipe.html
index ea93674..c88592a 100644
--- a/_includes/extensions/photo-swipe.html
+++ b/_includes/extensions/photo-swipe.html
@@ -23,8 +23,8 @@
imgEl.outerHTML = `
<a class="photo-swipe"
href="${imgEl.src}"
- data-width="${imgEl.getAttribute("width") || imgEl.width * 2}"
- data-height="${imgEl.getAttribute("height") || imgEl.height * 2}"
+ data-width="${Math.max(imgEl.naturalWidth, imgEl.width) * 2}"
+ data-height="${Math.max(imgEl.naturalHeight, imgEl.height) * 2}"
data-caption="${imgEl.getAttribute("caption") || imgEl.alt}"
target="_blank">
${imgEl.outerHTML}
@@ -63,7 +63,6 @@
bgOpacity: 0.85,
showHideOpacity: true,
closeOnScroll: true,
- maxSpreadZoom: 1,
getDoubleTapZoom: (isMouseClick, item) => {
if (item.detail) {
zoomLevel += item.detail.origEvent.shiftKey ? -1 : 1;