DEV Community

Discussion on: Background-Image-On-Load

Collapse
alirezavalizade profile image
alireza valizade Author

it's only 3 lines. the rest is customizable

const img = new Image(src);
img.onload = () => {
  .....
};
Collapse
notrealdev profile image
notrealdev

Not works for me.
backgroundImage does not work completely in my opinion.
I must use dataURL for it, thank you.