How to load images after page loaded?

后端 未结 3 1797
情话喂你
情话喂你 2021-01-01 09:14

I have this code:

            

        
3条回答
  •  执念已碎
    2021-01-01 09:57

    Check this link

    This plugin loads images / background url after the DOM load event and window load event are triggered.

    Initially the src attribute of the img tag will be set to empty. And the html should contain a data attribute which will contain the image path. The plugin will take care of the rest of things.

    After image loads, the below code will be executed. All these are handled by the plugin

    $('img').attr('src', < data URL with the img path > )
    

提交回复
热议问题