Fix null imgPrev in setPos

This commit is contained in:
r 2022-01-27 11:52:47 +00:00
parent 0b004efffa
commit 4ef5e0daf2

View file

@ -246,11 +246,11 @@ function handleImgPreview(a) {
img.src = e.target.getAttribute("href"); img.src = e.target.getAttribute("href");
img.style["max-width"] = mw + "px"; img.style["max-width"] = mw + "px";
img.style["max-height"] = mh + "px"; img.style["max-height"] = mh + "px";
imgPrev = img;
img.onload = function(e2) { img.onload = function(e2) {
setPos(imgPrev, imgX, imgY, mw, mh); setPos(imgPrev, imgX, imgY, mw, mh);
} }
document.body.appendChild(img); document.body.appendChild(img);
imgPrev = img;
} }
a.onmouseleave = function(e) { a.onmouseleave = function(e) {
var img = document.getElementById("img-preview"); var img = document.getElementById("img-preview");