forked from luis-almeida/unveil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
210 lines (187 loc) · 24.3 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="Filtrify">
<meta name="keywords" content="javascript, jquery, lazy load, performance, plugin" />
<meta name="author" content="Luís Almeida">
<meta name="viewport" content="width=device-width">
<title>jQuery Unveil - A very lightweight plugin to lazy load images</title>
</head>
<style>
body {
background: #FFF;
color: #555;
font-family: "Helvetica Neue", sans-serif;
font-weight: 300;
line-height: 1.7;
padding: 30px 30px 300px 30px;
margin: 0 auto;
max-width: 480px;
}
header {
margin: 100px 0;
}
header p {
color: #CCC;
margin: 0 0 25px 0;
}
header h1 {
color: #000;
font-size: 75px;
line-height: 1;
margin: 0 0 10px 0;
}
header h1 small{
font-size: 16px;
}
h2 {
color: #333;
margin-top: 100px;
font-size: 1em;
}
p {
margin: 15px auto;
}
a {
color: #3595b5;
}
strong {
font-size: 1.5em;
color: #CCC;
}
code {
}
code > span.red {
color: #D14;
}
code > span.blue {
color: #099;
}
code > span.purple {
color: #C0C;
}
ul {
list-style: none;
padding: 0;
}
ul > li {
margin-top: 50px;
text-align: center;
}
ul > li > img {
display: inline-block;
max-width: 100%;
min-width: 48px;
min-height: 48px;
background-repeat: no-repeat;
background-image: url(data:image/gif;base64,R0lGODlhMAAwAPcAAAAAABMTExUVFRsbGx0dHSYmJikpKS8vLzAwMDc3Nz4+PkJCQkRERElJSVBQUFdXV1hYWFxcXGNjY2RkZGhoaGxsbHFxcXZ2dnl5eX9/f4GBgYaGhoiIiI6OjpKSkpaWlpubm56enqKioqWlpampqa6urrCwsLe3t7q6ur6+vsHBwcfHx8vLy8zMzNLS0tXV1dnZ2dzc3OHh4eXl5erq6u7u7vLy8vf39/n5+f///wEBAQQEBA4ODhkZGSEhIS0tLTk5OUNDQ0pKSk1NTV9fX2lpaXBwcHd3d35+foKCgoSEhIuLi4yMjJGRkZWVlZ2dnaSkpKysrLOzs7u7u7y8vMPDw8bGxsnJydvb293d3eLi4ubm5uvr6+zs7Pb29gYGBg8PDyAgICcnJzU1NTs7O0ZGRkxMTFRUVFpaWmFhYWVlZWtra21tbXNzc3V1dXh4eIeHh4qKipCQkJSUlJiYmJycnKampqqqqrW1tcTExMrKys7OztPT09fX19jY2Ojo6PPz8/r6+hwcHCUlJTQ0NDg4OEFBQU9PT11dXWBgYGZmZm9vb3Jycnp6en19fYCAgIWFhaurq8DAwMjIyM3NzdHR0dTU1ODg4OTk5Onp6fDw8PX19fv7+xgYGB8fHz8/P0VFRVZWVl5eXmpqanR0dImJiaCgoKenp6+vr9/f3+fn5+3t7fHx8QUFBQgICBYWFioqKlVVVWJiYo+Pj5eXl6ioqLa2trm5udbW1vT09C4uLkdHR1FRUVtbW3x8fJmZmcXFxc/Pz42Njb+/v+/v7/j4+EtLS5qamri4uL29vdDQ0N7e3jIyMpOTk6Ojo7GxscLCwisrK1NTU1lZWW5ubkhISAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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ter-share-button {
margin-left: 20px;
}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery.unveil.js"></script>
<script>
$(function() {
$("li img").unveil(300);
});
</script>
<body>
<header>
<h1>Unveil<small>.js</small></h1>
<p>A very lightweight plugin to lazy load images for jQuery or Zepto.js</p>
<iframe src="http://ghbtns.com/github-btn.html?user=luis-almeida&repo=unveil&type=watch" allowtransparency="true" frameborder="0" scrolling="0" width="55" height="20"></iframe>
<iframe src="http://ghbtns.com/github-btn.html?user=luis-almeida&repo=unveil&type=fork" allowtransparency="true" frameborder="0" scrolling="0" width="55" height="20"></iframe>
<a href="https://twitter.com/share" class="twitter-share-button" data-text="unveil.js - A very lightweight plugin to lazy load images" data-via="lmgalmeida" data-related="lmgalmeida" data-count="none">Tweet</a>
</header>
<p>Most of us are familiar with the <a target="_blank" href="http://www.appelsiini.net/projects/lazyload">Lazy Load</a> plugin by <a target="_blank" href="http://www.appelsiini.net/">Mika Tuupola</a>.
<p>This plugin is very useful and it boosts performance delaying loading of images in long web pages because images outside of viewport (visible part of web page) won't be loaded until the user scrolls to them.</p>
<p>Lazy Load has some cool options such as custom effects, container, events or data attribute. If you're not gonna use any of them you can reduce the file size by leaving just the essential code to show the images.</p>
<p>That's what I did and this is my lightweight version of Lazy Load with support for serving high-resolution images to devices with retina displays - <strong>less than 1k</strong>.</p>
<h2>Usage</h2>
<p>Use a placeholder image in the src attribute - something to be displayed while the original image loads - and include the actual image source in a "data-src" attribute.</p>
<p>If you want to serve high-resolution images to devices with retina displays, you just have to include the source for those images in a "data-src-retina" attribute.</p>
<p>You don't need to include a "data-src-retina" attribute in all the image tags, unveil is smart enough to fallback to "data-src" or even do nothing in case there isn't any "data-src" specified.</p>
<code><img <span class="blue">src=</span><span class="red">"bg.png"</span> <span class="blue">data-src=</span><span class="red">"img1.jpg"</span> /></code>
<br>
<code><img <span class="blue">src=</span><span class="red">"bg.png"</span> <span class="blue">data-src=</span><span class="red">"img2.jpg"</span> <span class="blue">data-src-retina=</span><span class="red">"img2-retina.jpg"</span> /></code>
<br>
<p>If you care about users without javascript enabled, you can include the original image inside a <noscript> tag:</p>
<code><noscript><br> <img <span class="blue">src=</span><span class="red">"img1.jpg"</span> /><br></noscript></code>
<br><br>
<p>Run the script on document ready:</p>
<code>$(<span class="blue">document</span>).ready(<span class="blue">function</span>() {<br>
$(<span class="red">"img"</span>).unveil();<br>
});</code>
<h2>Threshold</h2>
<p>By default, images are only loaded and "unveiled" when the user scrolls to them and they became visible on the screen.</p>
<p>If you want your images to load earlier than that, lets say 200px before they appear on the screen, you just have to:</p>
<code>$(<span class="red">"img"</span>).unveil(<span class="purple">200</span>);</code>
<h2>Callback</h2>
<p>As a second parameter you can also specify a callback function that will fire after an image has been "unveiled".</p>
<p>Inside the callback function <code>this</code> refers to the image's DOM node, so with the help of CSS3 (or jQuery animations) and by attaching a simple load event you can easily add some fancy entrance animation to your images:</p>
<code><span class="blue">img</span> {<br>
opacity: 0;<br>
transition: opacity .3s ease-in;<br>
}</code>
<br><br>
<code>$(<span class="red">"img"</span>).unveil(<span class="purple">200</span>, <span class="blue">function</span>() {<br>
$(this).load(<span class="blue">function</span>() {<br>
this.style.opacity = 1;<br>
});<br>
});</code>
<h2>Trigger</h2>
<p>You can still trigger image loading whenever you need.</p>
<p>All you have to do is select the images you want to "unveil" and trigger the event:</p>
<code>$(<span class="red">"img"</span>).trigger(<span class="red">"unveil"</span>);</code>
<h2>Lookup</h2>
<p>It is also possible to lookup for images in the viewport that haven't been "unveiled" yet.</p>
<p>This can be useful, for instance, in case of a tabbed layout.</p>
<code>$(<span class="blue">window</span>).trigger(<span class="red">"lookup"</span>);</code>
<h2>Cancel</h2>
<p>You can remove all the "unveil" event handlers from "window":</p>
<code>$(<span class="blue">window</span>).off(<span class="red">"unveil"</span>);</code>
<h2>Demo</h2>
<p>If you're on a "normal" display, unveil will load the low resolution version (800x500). In case you're on a device with a retina display, the high resolution version (1280x800 in this case) will be loaded instead.</p>
<p>Scroll down to see it working - placeholder images from <a href="http://lorempixel.com/">lorempixel</a>.</p>
<ul>
<li><img data-src="http://lorempixel.com/g/800/500/city/1" data-src-retina="http://lorempixel.com/g/1280/800/city/1" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /></li>
<li><img data-src="http://lorempixel.com/g/800/500/city/2" data-src-retina="http://lorempixel.com/g/1280/800/city/2" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /></li>
<li><img data-src="http://lorempixel.com/g/800/500/city/3" data-src-retina="http://lorempixel.com/g/1280/800/city/3" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /></li>
<li><img data-src="http://lorempixel.com/g/800/500/city/4" data-src-retina="http://lorempixel.com/g/1280/800/city/4" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /></li>
<li><img data-src="http://lorempixel.com/g/800/500/city/5" data-src-retina="http://lorempixel.com/g/1280/800/city/5" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /></li>
<li><img data-src="http://lorempixel.com/g/800/500/city/6" data-src-retina="http://lorempixel.com/g/1280/800/city/6" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /></li>
<li><img data-src="http://lorempixel.com/g/800/500/city/7" data-src-retina="http://lorempixel.com/g/1280/800/city/7" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /></li>
<li><img data-src="http://lorempixel.com/g/800/500/city/8" data-src-retina="http://lorempixel.com/g/1280/800/city/8" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /></li>
<li><img data-src="http://lorempixel.com/g/800/500/city/9" data-src-retina="http://lorempixel.com/g/1280/800/city/9" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /></li>
<li><img data-src="http://lorempixel.com/g/800/500/city/10" data-src-retina="http://lorempixel.com/g/1280/800/city/10" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /></li>
</ul>
<h2>Browser support</h2>
<p>Compatible with All Browsers and IE7+.</p>
<h2>Download</h2>
<p>Download the script from the project page on <a href="https://github.com/luis-almeida/unveil">GitHub</a>.</p>
<p>If you have any suggestion or bug to report please use github issues or get it touch with me on twitter - <a href="https://twitter.com/lmgalmeida">@lmgalmeida</a>.</p>
<h2>License</h2>
<p>Unveil is licensed under the <a href="http://opensource.org/licenses/MIT">MIT license</a>.</p>
<script>
// Twitter
!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){
js=d.createElement(s);
js.id=id;
js.src="//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);
}
}(document,"script","twitter-wjs");
// Analytics
var _gaq=[['_setAccount','UA-30936310-1'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
</body>
</html>