What workarounds exist for the `complete` property in FireFox?

前端 未结 7 1699
温柔的废话
温柔的废话 2020-12-17 16:31

I am attempting to use jQuery to determine if an image has properly loaded.

The following works just fine (and returns true or false as of

7条回答
  •  醉酒成梦
    2020-12-17 17:17

    myimage=new Image();
    myimage.src="whatever";
    if(myimage.height>0 && myimage.complete){alert("my image has loaded");}
    
    // might be overly simple but works for me in all browsers i think.
    

提交回复
热议问题