Skip to content

A platform for community discussion. Free, open, simple.

FIX: Apply classes when lazily loading images

Robin Ward312e282b6ae3
diff --git a/app/assets/javascripts/discourse/lib/lazy-load-images.js.es6 b/app/assets/javascripts/discourse/lib/lazy-load-images.js.es6
index b291fcdc94f..8e0a2563e0e 100644
--- a/app/assets/javascripts/discourse/lib/lazy-load-images.js.es6
+++ b/app/assets/javascripts/discourse/lib/lazy-load-images.js.es6
@@ -19,7 +19,8 @@ function hide(image) {
src: image.src,
srcset: image.srcset,
width: image.width,
- height: image.height
+ height: image.height,
+ className: image.className
});
image.removeAttribute("srcset");
@@ -51,6 +52,7 @@ function show(image) {
copyImg.style.left = `${image.offsetLeft}px`;
copyImg.style.width = imageData.width;
copyImg.style.height = imageData.height;
+ copyImg.className = imageData.className;
image.parentNode.appendChild(copyImg);
} else {