Home > Article > Web Front-end > jquery implements getting the image height or width after the page is loaded_jquery
Recently, this technical person encountered another very interesting problem. In response to project requirements, it was necessary to obtain the height of the image after the page was loaded, so as to adjust the position of the overlay on the image relative to the top of the image.
But after writing it in jquery(function(){ /*XXXXXX*/});, I found that it is not very ideal, because when jquery is ready, the image is not loaded in most cases. Finished, this is really annoying~~~T~T
I just thought, if only jquery had a method like js’s onload(), it would be great. Oh~ It’s really falling from the sky. Big shit happened to hit this loser~~ After searching on the Internet, there is such a method. It is written as follows: