How can I hide a page contents until all the images are fully loaded?

后端 未结 5 1912
谎友^
谎友^ 2021-01-14 01:09

I am trying to optimize a site which loads terribly. I already reordered, compressed and minified js and css, but the biggest problem are the images. This site has some real

5条回答
  •  猫巷女王i
    2021-01-14 01:37

    Just after the Body tag, add a Div Element to cover the whole length and breadth of the page, make it white background or add a "Loading" image, set its z-index to Max (9999 or something) so its on top of everything, and give it some ID/Name

    and Use a Javascript with Body onLoad Event to hide or remove that Div Element.

    Something like

    
    
    
    Loading...

提交回复
热议问题