Optimize javascript pre-load of images

后端 未结 5 2191
無奈伤痛
無奈伤痛 2021-02-09 20:19

I was wondering if anyone has any strategies for optimizing the pre-loading of images via javascript?

I\'m porting a Flash application into html/css, attempting to recre

5条回答
  •  别那么骄傲
    2021-02-09 20:34

    If you don't need all the images right away, you can use the window.timeout() function to do some of the work after the page has initialized.

    Also, if you use one image in multiple places, you can avoid multiple calls to the server by putting the image into a CSS style and reusing that style instead of the image.

提交回复
热议问题