psimage: load thumbnail

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
pull/504/head
Varun Patil 2023-03-18 20:59:26 -07:00
parent 7c04313519
commit ab4426dc73
1 changed files with 7 additions and 1 deletions

View File

@ -36,7 +36,13 @@ export default class ImageContentSetup {
getXImgElem(content: any, onLoad: () => void): HTMLImageElement {
const img = document.createElement("img");
img.classList.add("pswp__img", "ximg");
// Load thumbnail in case the user is scrolling fast
if (content.data.msrc) {
img.src = content.data.msrc;
} else {
img.style.visibility = "hidden";
}
// Fetch with Axios
fetchImage(content.data.src).then((blob) => {