mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 14:39:48 +08:00
FIX: Apply classes when lazily loading images
If an image had extra classes (for example oneboxes), then while loading the copy of the image would lose those classes and look differently until the image had loaded fully. This fix copies the classes while loading.
This commit is contained in:
parent
439eff4709
commit
312e282b6a
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user