fix: set the zoom width and height for network image (#136)

This commit is contained in:
dabuside 2024-07-28 18:02:28 +08:00 committed by saicaca
parent 51025f0ea7
commit 09e084fd5b
1 changed files with 3 additions and 3 deletions

View File

@ -153,12 +153,12 @@ function createPhotoSwipe() {
pswpModule: () => import("photoswipe"), pswpModule: () => import("photoswipe"),
}) })
lightbox.addFilter("domItemData", (itemData, element, linkEl) => { lightbox.addFilter("domItemData", (itemData, element) => {
if (element instanceof HTMLImageElement) { if (element instanceof HTMLImageElement) {
itemData.src = element.src itemData.src = element.src
itemData.w = Number(element.getAttribute("width")) itemData.w = Number(element.naturalWidth || window.innerWidth)
itemData.h = Number(element.getAttribute("height")) itemData.h = Number(element.naturalHeight || window.innerHeight)
itemData.msrc = element.src itemData.msrc = element.src
} }