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

前端 未结 7 1693
温柔的废话
温柔的废话 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:30

    I dont know if firefox has another prop, method that does it but, you can use this workaround:

    $(document).ready(function(){

    $("img").each(
    //for each image declared in html
    function(index)
    {
        document.images[index].complete= false;
        document.images[index].onload = function(){ this.complete= true};
    });
    

    });

提交回复
热议问题