等待使用jquery完全加载特定图像? [英] Wait for a particular image to load completely using jquery?
本文介绍了等待使用jquery完全加载特定图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在使用下面的代码加载图片,但我想在图片完全加载之前显示某种加载gif。
I am currently using the code below to load images but I want to show some kind of loading gif before the image loads completely.
$('#addimage').attr('src', src[i]);
$('#addimage').show();
因为我在动画媒体框中使用它,所以块中的图像加载看起来不太好图像加载的时间我想通过显示加载gif来替换它。谢谢
Since I am using this in a animated mediabox the image loading in blocks does not look good so by the time the image is loading I want to replace it by showing a loading gif. Thanks
推荐答案
使用 load()
事件:
$("#addimage").load(function() {
$(this).show();
});
编辑:显示一张图片,直到另一张图片更加错综复杂但完全有可能。请参阅图像加载。
to show one image until another loads is a little more convoluted but entirely possible. See Image Loading.
这篇关于等待使用jquery完全加载特定图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文