Wait for images to load and then execute all other code

后端 未结 6 1630
广开言路
广开言路 2021-02-14 14:24

OK, I\'m losing my mind over this. I did read here at SO and google about it, I even have the preloader set (found here on SO), but none of the plugins/code I found helped me. <

6条回答
  •  [愿得一人]
    2021-02-14 15:01

    I believe the best jQuery option is to use the ajax get call:

    $.get('image.png', {}, function(){
        // Do whatever you want here, this wont execute until image.png is preloaded
    });
    

提交回复
热议问题