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

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

问题描述

当图像从服务器或浏览器缓存中完成加载后,如何使用JavaScript或jQuery进行检测?我想在相同的< img/> 标签中加载各种图像,并检测何时完成新图像的加载.

How can I detect with JavaScript or jQuery 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
});

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

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