jQuery或JavaScript:确定图像何时完成加载 [英] jQuery or JavaScript: Determine when image finished loading

查看:153
本文介绍了jQuery或JavaScript:确定图像何时完成加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从服务器或浏览器缓存中检测图像何时完成加载?
我想在相同的< img /> 标记中加载各种图像,并检测新图像的加载何时结束。

How can I detect when an image has finished loading be it from the server or the browser cache? I want to load various images in the same <img/> tag and detect when the loading of a new images has finished.

谢谢。

推荐答案

$('img').on('load', function() {
    // do whatever you want
});

这篇关于jQuery或JavaScript:确定图像何时完成加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆