是否可以检测何时通过jQuery事件加载图像?
要使用jQuery检测图像的加载,请使用load()事件处理程序。
注意:load()jQuery1.8版中不推荐使用该方法。在3.0版中将其完全删除。要查看其工作原理,请在3.0之前添加CDN的jQuery版本。
示例
您可以尝试运行以下代码,以了解如何检测图像加载时间:
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.staticfile.org/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("img").load(function(){
alert("图像成功加载。");
});
});
</script>
</head>
<body>
<img src="/videotutorials/images/tutor_connect_home.jpg" alt="Tutor" width="304" height="236">
<p><strong>Note:</strong> The load() method deprecated in jQuery version 1.8. It was completely removed in version 3.0. To see its working, add jQuery version for CDN before 3.0.</p>
</body>
</html>热门推荐
1 狗狗下楼训练
3 狗狗训练头盔
6 狗狗训练机构
7 训练狗狗步骤
9 狗狗能训练
10 狗狗基本动作训练方法
11 怎么训练狗狗叼饭盆
12 狗狗一岁了还能训练吗
13 训练狗狗的
14 宁波狗狗训练
15 训练狗狗拉屎
16 教狗狗训练
17 狗狗要怎么训练上厕所
18 狗狗靠的训练