fix: set the zoom width and height for network image (#136)
This commit is contained in:
parent
51025f0ea7
commit
09e084fd5b
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue