There is no reliable method. Using JavaScript will mean that images will never be downloaded for users who have disabled scripts or browsers that do not support it.
Almost all external resources (one of the exceptions being scripts) of the page are loaded asynchronously, starting with how they are analyzed by the browser. This means that, most likely, these will be smaller files that are downloaded first, and large files take longer to load and display.
Perhaps you will sprite all smaller images into one image, which will make the file size larger so that they all appear at the same time (instead of sequential), but I would not recommend it for any normal page with all my heart. The process simply included adjusting the position of the background to display only the image you want from the collection. If the collection is larger than the background image and the background image starts loading first, there is a good chance that the background will be displayed in front of the images.
source share