Checking for multiple images loaded

后端 未结 7 2186
死守一世寂寞
死守一世寂寞 2021-02-20 09:26

I\'m using the canvas feature of html5. I\'ve got some images to draw on the canvas and I need to check that they have all loaded before I can use them.

I have declared

7条回答
  •  执念已碎
    2021-02-20 09:55

    If you want to call a function when all the images are loaded, You can try following, it worked for me

    var imageCount = images.length;
    var imagesLoaded = 0;
    
    for(var i=0; i

提交回复
热议问题