From 09e084fd5b56e451aa7548bceece1e3b4b9d0167 Mon Sep 17 00:00:00 2001 From: dabuside Date: Sun, 28 Jul 2024 18:02:28 +0800 Subject: [PATCH] fix: set the zoom width and height for network image (#136) --- src/pages/posts/[...slug].astro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro index df9ca85..36b48f2 100644 --- a/src/pages/posts/[...slug].astro +++ b/src/pages/posts/[...slug].astro @@ -153,12 +153,12 @@ function createPhotoSwipe() { pswpModule: () => import("photoswipe"), }) - lightbox.addFilter("domItemData", (itemData, element, linkEl) => { + lightbox.addFilter("domItemData", (itemData, element) => { if (element instanceof HTMLImageElement) { itemData.src = element.src - itemData.w = Number(element.getAttribute("width")) - itemData.h = Number(element.getAttribute("height")) + itemData.w = Number(element.naturalWidth || window.innerWidth) + itemData.h = Number(element.naturalHeight || window.innerHeight) itemData.msrc = element.src }