-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloadingSkeleton.html
More file actions
132 lines (106 loc) · 2.91 KB
/
loadingSkeleton.html
File metadata and controls
132 lines (106 loc) · 2.91 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
* {
margin: 0;
padding: 0;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: #222;
padding: 0 1rem;
}
/* CARD */
.card {
max-width: 400px;
box-shadow: 0 .5rem 2rem rgba(0, 0, 0, .1);
padding: 1.5rem;
border-radius: .5rem;
}
.card-image {
margin-bottom: 1rem;
}
.card-image img {
width: 100%;
aspect-ratio: 4 / 3;
object-fit: cover;
border-radius: .25rem;
}
.card-title {
font-size: 1.25rem;
color: #222;
text-decoration: none;
font-weight: 600;
margin-bottom: .25rem;
display: inline-block;
}
.card-description {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
text-overflow: ellipsis;
overflow: hidden;
}
/* CARD */
/* SKELETON */
.skeleton {
position: relative;
}
.skeleton::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
background: linear-gradient(90deg, #eee, #f9f9f9, #eee);
background-size: 200%;
animation: skeleton 1s infinite reverse;
}
@keyframes skeleton {
0% {
background-position: -100% 0;
}
100% {
background-position: 100% 0;
}
}
/* SKELETON */
</style>
<body>
<div class="card">
<div class="card-image skeleton">
<img src="https://images.unsplash.com/photo-1618005198919-d3d4b5a92ead?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTB8fGlsbHVzdHJhdGlvbnxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=500&q=60"
alt="">
</div>
<a href="#" class="card-title skeleton">Card title here</a>
<p class="card-description skeleton">Lorem ipsum dolor sit amet consectetur adipisicing elit. Minima repudiandae
nobis doloremque ipsa et voluptatum vero architecto voluptatem, veniam, qui, at voluptatibus facilis
mollitia dicta laborum. Perferendis unde quasi reprehenderit?</p>
</div>
<script>
const allSkeleton = document.querySelectorAll('.skeleton')
window.addEventListener('load', function () {
allSkeleton.forEach(item => {
item.classList.remove('skeleton')
})
})
</script>
</body>
</html>