开发者

Is there a way to tell how much of an image is already loaded?

开发者 https://www.devze.com 2023-01-18 18:21 出处:网络
Is there a way to know how much percentage of one image is already loaded? Kind of a onProgress event for the load? So if I would do something like this开发者_如何学Python:

Is there a way to know how much percentage of one image is already loaded? Kind of a onProgress event for the load? So if I would do something like this开发者_如何学Python:

$('<img/>').load(function(){
    $(this).appendTo(some div);
})
.error()
.attr('src',some source);

I could have some progress bar indicating how much of the previous load is complete.


There isn't a way to detect/get this information, it just isn't exposed to JavaScript at all...only the onload when it's finished is fired (or onerror, if it fails).

0

精彩评论

暂无评论...
验证码 换一张
取 消