FIX: Prevent layout changes while images are lazy-loading

This commit moves the temporary image to be adjacent to the original image in the DOM. Previously the temporary image was appended to the parent element. Normally this makes no difference because the temporary element has position:absolute. However, if the `:last-child` selector is being used on the parent, it can cause layout changes during loading.
This commit is contained in:
David Taylor 2019-01-15 17:35:55 +00:00
parent 70cdb42173
commit b69e57e2f3

View File

@ -54,7 +54,7 @@ function show(image) {
copyImg.style.height = imageData.height;
copyImg.className = imageData.className;
image.parentNode.appendChild(copyImg);
image.parentNode.insertBefore(copyImg, image);
} else {
image.classList.remove("d-lazyload-hidden");
}