Z
Z
zv3472021-04-12 16:24:22
JavaScript
zv347, 2021-04-12 16:24:22

How to track the loading of an image on a page?

There is a page with three canvas. By event, the script draws three images on them with the given src. Images should not be drawn at the moment the page is loaded, and in general they can change while working with the page. The page does not reload.

Problem. The script that loads pictures and draws them on the canvas "works out" before the pictures are actually loaded, respectively, emptiness is "drawn" on the canvas. When re-executing, i.e. with cached images, everything is fine.

Question. How to track that the picture is really fully loaded? Tracking the image object in the DOM does not help, the object is there, but it is underloaded.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alice, 2021-04-12
@zv347

Hold

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question