-
Notifications
You must be signed in to change notification settings - Fork 247
/
aftLoadImg.html
executable file
·41 lines (37 loc) · 1.08 KB
/
aftLoadImg.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<p><img src="error.jpg" data-src="https://materialdb.zhaoyl.com/201809/105567.jpg" width="264"/></p>
<p><img src="error.jpg" data-src="https://materialdb.zhaoyl.com/201809/106796.jpg" width='264'/></p>
<p><img src="error.jpg" data-src="https://materialdb.zhaoyl.com/201809/1067961.jpg" width='264'/></p>
</body>
<script src="../src/ec-do-3.0.0-beta.2.js"></script>
<script>
//测试前请先清空缓存,调低网络速度
window.onload = function () {
let oImg=document.getElementsByTagName('img');
for(let i=0;i<oImg.length;i++){
ecDo.aftLoadImg({
dom:oImg[i],
url:oImg[i].dataset.src,
errorUrl:oImg[i].src,
fn:function (dom,msg) {
console.log(`第${i+1}张图${msg?'加载成功':'加载失败'}`)
}
})
}
}
</script>
</html>
</body>
</html>