Load a low-res background image first, then a high-res one

前端 未结 6 925
陌清茗
陌清茗 2020-12-04 17:56

I am trying to optimize the size of my site when it is being outputted to the client. I am down to 1.9MB and 29KB when caching. The issue is that the first load contains an

6条回答
  •  执念已碎
    2020-12-04 19:02

    Let's try a basic one :

    
    

    zWfJ5.jpg is the low-resolution version, and XOYra.jpg is the high-resolution version.

    If there is a way to arrange the loading so the background-image displays first, this could be the simplest i can think of.

    where low resolution 44k:

    and high resolution is 1.16M

    result :

    jsFiddled here ( this needs a bigger image for loading comparison. )

提交回复
热议问题