Optimize javascript pre-load of images

后端 未结 5 2193
無奈伤痛
無奈伤痛 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:27

    Using a sprite is good if you're OK with that solution. Also, what I'd try is to detect data URI support in that browser and have the script load different stylesheets base on that info. One stylesheets with base 64 encoded data URIs and the other with a real URL to the sprite. The CSS file is also cacheable.

    Here's a technique to detect data URIs support or you could use IE conditional comments or... there are some workarounds for sending IE encoded image strings, in multipart HTTP responses.

提交回复
热议问题