Sometimes it is necessary to obtain the width and height of images in web pages to define certain sizes. However, this requires requesting images from the server and downloading them locally. Some js or jquery codes are executed before the images are loaded. . What to do?
jquery provides a method:
01 .$("").load(function(){...});
The selector is the id or class of the image, and the method in function is the callback function. After the image is loaded, After execution, but I have tested a lot, it is not the case at all. The correct solution is:
Use the onload method of js:
document.getElementById("").onload = function() {};
The experimental result is feasible.