-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
140 lines (108 loc) · 2.96 KB
/
index.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
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
133
134
135
136
137
138
139
<!doctype html>
<html lang="en-US">
<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, minimum-scale=1">
<title>TinyLazyLoad by metinsaylan</title>
<style>
/*
Note:
CSS is not required, for demo only
*/
html,
body {
height: 100%;
background: #eee;
}
body {
max-width: 600px;
margin: 0 auto;
}
body, p {
font-family: Segoe UI, Arial,Helvetica,sans-serif;
font-size: 18px;
}
header {
background: #ffeb3b;
padding: 2rem;
margin: 3rem;
}
header h1 {
line-height: 1;
margin: 0;
}
section {
height: 100%;
background: #fff;
box-shadow: 0 4px 15px rgb(0 0 0 / 10%), 2px 4px 7px rgb(0 0 0 / 10%),
-2px 4px 7px rgb(0 0 0 / 10%);
border: 0;
border-radius: 10px;
margin: 3rem;
}
section img {
max-width: 100%;
object-fit: cover;
}
section iframe {
width: 100%;
}
section p, section pre {
margin: 2rem;
}
pre {
background: #eee;
padding: 1rem;
overflow: auto;
}
.thmb {
min-height: 300px;
background-position: center;
background-size: cover;
background-color: #eee;
}
.lazy {
background-color: #333;
}
footer {
text-align: center;
margin: 3rem;
}
</style>
</head>
<body>
<header>
<h1>TinyLazyLoad</h1>
<a href="/~https://github.com/metinsaylan/tinylazyload">/~https://github.com/metinsaylan/tinylazyload</a>
</header>
<section>
<img class="lazy thmb bg-c" src="" data-src="https://picsum.photos/id/102/1200/480/">
<p>Add "<code>lazy</code>" CSS class to any image, iframe.</p>
</section>
<section>
<img class="lazy thmb bg-c" src="" data-src="https://picsum.photos/id/1001/1200/480/">
<p>Use <code>data-src</code> attribute for images and iframes:</p>
<pre><img class="lazy" src="" data-src="https://picsum.photos/id/1001/1200/480/"></pre>
</section>
<section>
<div class="lazy thmb bg-c" data-src-background="https://picsum.photos/id/1051/1200/480/"></div>
<p>Use <code>data-src-background</code> attribute for background images:</p>
<pre><div class="lazy thmb bg-c" data-src-background="https://picsum.photos/id/1051/1200/480/"></pre>
</section>
<section>
<img class="lazy thmb bg-c" src="" data-src="https://picsum.photos/1200/480/">
</section>
<section>
<img class="lazy thmb bg-c" src="" data-src="https://picsum.photos/id/109/1200/480/">
</section>
<section>
<iframe width="560" height="315" src="" class="lazy" data-src="https://www.youtube.com/embed/HG92yUC59Nk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<p>You can even use it to lazy load iframe embeds.</p>
</section>
<footer>
<p>by <a href="https://metinsaylan.com">metinsaylan</a></p>
</footer>
<script src="tinylazyload.js"></script>
</body>
</html>