-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskeleton.html
61 lines (61 loc) · 2.02 KB
/
skeleton.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>骨架屏的动画效果</title>
<style>
.skeleton-item{
display: inline-block;
height: 16px;
border-radius: 4px;
background: linear-gradient(90deg,#f2f2f2 25%,#e6e6e6 37%,#f2f2f2 63%);
background-size: 400% 100%;
}
.skeleton-loading{
animation: skeleton-loading 1.4s ease infinite;
}
@keyframes skeleton-loading{
0%{
background-position:100% 50%
}
to{
background-position:0 50%
}
}
.row-20{
width: 20%;
}
.row-80{
width:80%
}
.row-100{
width: 100%;
}
.skeleton-img{
width: 240px;
height: 240px;
background: #f2f2f2;
background: linear-gradient(90deg,#f2f2f2 25%,#e6e6e6 37%,#f2f2f2 63%);
background-size: 400% 100%;
}
.skeleton-img svg{
fill: #dcdde0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<p>骨架屏的原理就是占位,可以设置每个对应的item为空白,等整体数据加载完成后隐藏该空白,展示真正的数据</p>
<div class="skeleton-wrapper">
<div class="skeleton-img skeleton-loading">
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M64 896V128h896v768H64z m64-128l192-192 116.352 116.352L640 448l256 307.2V192H128v576z m224-480a96 96 0 1 1-0.064 192.064A96 96 0 0 1 352 288z"></path></svg>
</div>
<div class="skeleton-item row-20 skeleton-loading"></div>
<div class="skeleton-item row-100 skeleton-loading"></div>
<div class="skeleton-item row-80 skeleton-loading"></div>
</div>
</body>
</html>