|
525
|
1 |
<!DOCTYPE html> |
|
|
2 |
<html lang="en"> |
|
|
3 |
<head> |
|
|
4 |
<meta charset="utf-8"> |
|
|
5 |
<title>ImageLoader</title> |
|
|
6 |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic"> |
|
|
7 |
<link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css"> |
|
|
8 |
<link rel="stylesheet" href="../assets/css/main.css"> |
|
|
9 |
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css"> |
|
|
10 |
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png"> |
|
|
11 |
<script src="../../build/yui/yui-min.js"></script> |
|
|
12 |
|
|
|
13 |
</head> |
|
|
14 |
<body> |
|
|
15 |
<!-- |
|
|
16 |
<a href="https://github.com/yui/yui3"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a> |
|
|
17 |
--> |
|
|
18 |
<div id="doc"> |
|
|
19 |
<div id="hd"> |
|
|
20 |
<h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1> |
|
|
21 |
</div> |
|
|
22 |
|
|
|
23 |
<a href="#toc" class="jump">Jump to Table of Contents</a> |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
<h1>ImageLoader</h1> |
|
|
27 |
<div class="yui3-g"> |
|
|
28 |
<div class="yui3-u-3-4"> |
|
|
29 |
<div id="main"> |
|
|
30 |
<div class="content"><div class="intro"> |
|
|
31 |
<p> |
|
|
32 |
The ImageLoader Utility allows you as an implementer to delay the loading of images on your web page until |
|
|
33 |
such a time as your user is likely to see them. This can improve your overall pageload performance by deferring |
|
|
34 |
the loading of some images that are not immediately visible at the time the page first renders. |
|
|
35 |
Because images are often the heaviest components of a given page, deferring the loading of some images can |
|
|
36 |
yield a marked improvement in the way the page "feels" to your user. |
|
|
37 |
</p> |
|
|
38 |
|
|
|
39 |
<p> |
|
|
40 |
The ImageLoader Utility lets you determine triggers and time limits to initiate image loading. |
|
|
41 |
This allows you to ensure that the images are loaded before your user is likely to see them. |
|
|
42 |
This technique, obviously, is appropriate only for images that are not immediately visible to your user at initial page load. |
|
|
43 |
</p> |
|
|
44 |
</div> |
|
|
45 |
|
|
|
46 |
<h2 id="getting-started">Getting Started</h2> |
|
|
47 |
|
|
|
48 |
<p> |
|
|
49 |
To include the source files for ImageLoader and its dependencies, first load |
|
|
50 |
the YUI seed file if you haven't already loaded it. |
|
|
51 |
</p> |
|
|
52 |
|
|
|
53 |
<pre class="code prettyprint"><script src="http://yui.yahooapis.com/3.10.3/build/yui/yui-min.js"></script></pre> |
|
|
54 |
|
|
|
55 |
|
|
|
56 |
<p> |
|
|
57 |
Next, create a new YUI instance for your application and populate it with the |
|
|
58 |
modules you need by specifying them as arguments to the <code>YUI().use()</code> method. |
|
|
59 |
YUI will automatically load any dependencies required by the modules you |
|
|
60 |
specify. |
|
|
61 |
</p> |
|
|
62 |
|
|
|
63 |
<pre class="code prettyprint"><script> |
|
|
64 |
// Create a new YUI instance and populate it with the required modules. |
|
|
65 |
YUI().use('imageloader', function (Y) { |
|
|
66 |
// ImageLoader is available and ready for use. Add implementation |
|
|
67 |
// code here. |
|
|
68 |
}); |
|
|
69 |
</script></pre> |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
<p> |
|
|
73 |
For more information on creating YUI instances and on the |
|
|
74 |
<a href="http://yuilibrary.com/yui/docs/api/classes/YUI.html#method_use"><code>use()</code> method</a>, see the |
|
|
75 |
documentation for the <a href="../yui/index.html">YUI Global Object</a>. |
|
|
76 |
</p> |
|
|
77 |
|
|
|
78 |
|
|
|
79 |
<h3 id="creating-an-image-group">Creating an Image Group</h3> |
|
|
80 |
<p> |
|
|
81 |
Images are organized into groups. Each group has one or more triggers. A trigger is simply any DOM event, |
|
|
82 |
such as the <code>mouseover</code> of a specific <code><div></code>, a button click, or a window scroll. |
|
|
83 |
The images in a group won't load into the page until this trigger fires. Groups also have an optional time limit; |
|
|
84 |
if none of the group's triggers are activated before the time limit expires, the images are fetched anyway. |
|
|
85 |
</p> |
|
|
86 |
<p> |
|
|
87 |
A group is defined as an instance of <code>Y.ImgLoadGroup</code>. It comprises a collection of images that will |
|
|
88 |
show up on the page based on the same triggers and time limit. |
|
|
89 |
|
|
|
90 |
<pre class="code prettyprint">var myFirstGroup = new Y.ImgLoadGroup({ timeLimit: 2 }); |
|
|
91 |
myFirstGroup.addTrigger('#someDivId', 'mouseover');</pre> |
|
|
92 |
|
|
|
93 |
</p> |
|
|
94 |
<p> |
|
|
95 |
This defines a group triggered by a <code>mouseover</code> of the <code><div></code> with the HTML ID |
|
|
96 |
of <code>someDivId</code>; with the <code>timeLimit</code> attribute we are specifying that all images |
|
|
97 |
in <code>myFirstGroup</code> should load two seconds after the window's <code>load</code> event fires even |
|
|
98 |
if our trigger hasn't been tripped. |
|
|
99 |
</p> |
|
|
100 |
|
|
|
101 |
<h3 id="adding-images-to-the-group">Adding Images to the Group</h3> |
|
|
102 |
<p> |
|
|
103 |
Register one or more images with the group using the HTML ID of the image element and the URL for the image: |
|
|
104 |
|
|
|
105 |
<pre class="code prettyprint">myFirstGroup.registerImage({ |
|
|
106 |
domId: 'idOfDivWaitingForImage', |
|
|
107 |
bgUrl: 'http://www.example.com/image/url' |
|
|
108 |
});</pre> |
|
|
109 |
|
|
|
110 |
</p> |
|
|
111 |
<p> |
|
|
112 |
This will set the image at <code>http://www.example.com/image/url</code> as the background image of |
|
|
113 |
the <code><div></code> with the ID <code>idOfDivWaitingForImage</code>. There are three kinds of images you |
|
|
114 |
can register with an ImageLoader group instance; see <a href="#addimages">Adding Images</a> below for more details on this process. |
|
|
115 |
</p> |
|
|
116 |
|
|
|
117 |
|
|
|
118 |
<h2 id="using">Using the ImageLoader Utility</h2> |
|
|
119 |
<p> |
|
|
120 |
This section describes how to use the ImageLoader Utility in further detail. It contains these subsections: |
|
|
121 |
</p> |
|
|
122 |
<ul> |
|
|
123 |
<li><a href="#performance">Performance Considerations</a></li> |
|
|
124 |
<li><a href="#approach">Approach</a></li> |
|
|
125 |
<li><a href="#triggers">Triggers</a></li> |
|
|
126 |
<li><a href="#customtriggers">Custom Event Triggers</a></li> |
|
|
127 |
<li><a href="#addimages">Adding Images</a></li> |
|
|
128 |
<li><a href="#fold">Loading Images Below the Fold</a></li> |
|
|
129 |
<li><a href="#visibility">Image Visibility</a></li> |
|
|
130 |
<li><a href="#classnames">Using Class Names</a></li> |
|
|
131 |
</ul> |
|
|
132 |
|
|
|
133 |
|
|
|
134 |
<h3 id="performance">Performance Considerations</h3> |
|
|
135 |
<p> |
|
|
136 |
The images on your page require possible DNS lookups, new HTTP transactions, and ultimately the transmission |
|
|
137 |
of image data in packets over the wire. While all this is happening, the user is often left waiting for the |
|
|
138 |
page to become fully functional. All of your <code>onload</code> JavaScript, for example, is deferred until |
|
|
139 |
after all the page's images have finished loading. |
|
|
140 |
</p> |
|
|
141 |
<p> |
|
|
142 |
Should the user have to wait for all of these images? If the images are front and center on the page, then yes, |
|
|
143 |
suffering the load time is necessary. But what about images that the user doesn't see right away — the images |
|
|
144 |
below the fold; the images hidden towards the end of a carousel; the images that won't appear until a non-default |
|
|
145 |
tab of some module is clicked? ImageLoader allows you to delay the load of these images until after page load so |
|
|
146 |
that the page is fully functional more quickly. And, by using triggers, you can ensure that the images are loaded |
|
|
147 |
just before the user needs them so that there's no degradation of user experience. |
|
|
148 |
</p> |
|
|
149 |
|
|
|
150 |
<h3 id="approach">Approach</h3> |
|
|
151 |
<p> |
|
|
152 |
How can you anticipate when the user will be able to see images? Well, you as a developer know your page, |
|
|
153 |
and you know what actions are available to the user. You can utilize your knowledge to identify user events |
|
|
154 |
that indicate what the user is about to see. |
|
|
155 |
</p> |
|
|
156 |
<p> |
|
|
157 |
For example, you know that any image lying below the fold won't be visible until the user either scrolls |
|
|
158 |
the page or resizes the browser window. In a tabbed module, you know that the user can't click one of the |
|
|
159 |
tabs until she mouses over that tab. |
|
|
160 |
</p> |
|
|
161 |
<p> |
|
|
162 |
Consequently, you can use scroll events, mouseover events, or other indicators of user intent to stay one |
|
|
163 |
step ahead of the user and decide when to load images. The ImageLoader Utility lets you do exactly this. |
|
|
164 |
</p> |
|
|
165 |
|
|
|
166 |
<h3 id="triggers">Triggers</h3> |
|
|
167 |
<p> |
|
|
168 |
Images are grouped together in terms of which user action(s) should trigger their loading. |
|
|
169 |
A trigger is simply any DOM event. Your first step is to create an ImageLoader group object and define its trigger: |
|
|
170 |
|
|
|
171 |
<pre class="code prettyprint">var myFirstGroup = new Y.ImgLoadGroup({ |
|
|
172 |
timeLimit: 2 |
|
|
173 |
}); |
|
|
174 |
myFirstGroup.addTrigger('#someDivId', 'mouseover');</pre> |
|
|
175 |
|
|
|
176 |
</p> |
|
|
177 |
<p> |
|
|
178 |
The <code>timeLimit</code> attribute is a time limit for the group. |
|
|
179 |
If the user has not performed the trigger event within the specified time limit, the images are fetched anyway. |
|
|
180 |
You can elect to not specify either the time limit or the trigger (indicating the user must perform the trigger event, |
|
|
181 |
or there should only be a simple time delay, respectively.) |
|
|
182 |
</p> |
|
|
183 |
<p> |
|
|
184 |
You can have as many triggers as you wish for a group. |
|
|
185 |
Just add them with the <code>group</code> class's <code>addTrigger</code> method: |
|
|
186 |
|
|
|
187 |
<pre class="code prettyprint">myFirstGroup.addTrigger('#someOtherDivId', 'click');</pre> |
|
|
188 |
|
|
|
189 |
</p> |
|
|
190 |
<p> |
|
|
191 |
The trigger conditionals are disjunctive; the first one to fire initiates the image fetching. |
|
|
192 |
</p> |
|
|
193 |
|
|
|
194 |
<h3 id="customtriggers">Custom Event Triggers</h3> |
|
|
195 |
<p> |
|
|
196 |
You can also specify custom events as triggers. If the event belongs to the <code>Y</code> instance, |
|
|
197 |
call <code>addCustomTrigger</code> with the event name: |
|
|
198 |
|
|
|
199 |
<pre class="code prettyprint">myFirstGroup.addCustomTrigger('mycustomevent:imgloadevent');</pre> |
|
|
200 |
|
|
|
201 |
</p> |
|
|
202 |
<p> |
|
|
203 |
Alternatively, if you have a custom event attached to a local object, you can specify this in the |
|
|
204 |
<code>addCustomTrigger</code> call: |
|
|
205 |
|
|
|
206 |
<pre class="code prettyprint">myFirstGroup.addCustomTrigger('mycustomevent:imgloadevent2', myCustomEvent);</pre> |
|
|
207 |
|
|
|
208 |
</p> |
|
|
209 |
<p> |
|
|
210 |
And this group's images will be fetched upon <code>myCustomEvent.fire('mycustomevent:imgloadevent2');</code>. |
|
|
211 |
</p> |
|
|
212 |
|
|
|
213 |
<h3 id="addimages">Adding Images</h3> |
|
|
214 |
<p>Once a group is created, you can add as many images as you'd like to it. There are three types of images:</p> |
|
|
215 |
<ol> |
|
|
216 |
<li> |
|
|
217 |
<strong>background image</strong> (a <code><div></code> with a background image; URL set in <code>style.backgroundImage</code>). |
|
|
218 |
Use the <code>bgUrl</code> attribute to register this kind of image. |
|
|
219 |
</li> |
|
|
220 |
<li> |
|
|
221 |
<strong>source image</strong> (an <code><img></code> tag; URL set in a <code>url</code> attribute). |
|
|
222 |
Use the <code>srcUrl</code> attribute to register this kind of image. |
|
|
223 |
</li> |
|
|
224 |
<li> |
|
|
225 |
<strong>png background image</strong> (a <code><div></code> with a png background image; for IE6, |
|
|
226 |
sets an alpha filter <code>src</code>; for other browsers sets a background image). |
|
|
227 |
Use the <code>isPng</code> and <code>bgUrl</code> attributes to register this kind of image. |
|
|
228 |
</li> |
|
|
229 |
</ol> |
|
|
230 |
<p> |
|
|
231 |
To add an image to a group, register the DOM ID of the image element and the image URL with the |
|
|
232 |
<code>registerImage</code> method: |
|
|
233 |
|
|
|
234 |
<pre class="code prettyprint">myFirstGroup.registerImage({ |
|
|
235 |
domId: 'idOfDivWaitingForImage', |
|
|
236 |
bgUrl: 'http://www.example.com/image/url' |
|
|
237 |
}); |
|
|
238 |
myFirstGroup.registerImage({ |
|
|
239 |
domId: 'idOfImgWaitingForImage', |
|
|
240 |
srcUrl: 'http://www.example.com/other/image/url' |
|
|
241 |
}); |
|
|
242 |
myFirstGroup.registerImage({ |
|
|
243 |
domId: 'idOfDivWaitingForPngImage', |
|
|
244 |
bgUrl: 'http://www.example.com/png/image/url', |
|
|
245 |
isPng: true |
|
|
246 |
});</pre> |
|
|
247 |
|
|
|
248 |
</p> |
|
|
249 |
<p> |
|
|
250 |
This will set the image at <code>http://www.example.com/image/url</code> as the background-image of |
|
|
251 |
the <code><div></code> with the ID <code>idOfDivWaitingForImage</code> and likewise with the two other image elements. |
|
|
252 |
</p> |
|
|
253 |
|
|
|
254 |
<h3 id="fold">Loading Images Below the Fold</h3> |
|
|
255 |
<p> |
|
|
256 |
A group can check its images at the DOM ready state and immediately begin loading those that are above the fold |
|
|
257 |
(i.e., inside the current viewport) while delaying the load of those that aren't. Just set a value for |
|
|
258 |
the <code>foldDistance</code> property of the group. Images are checked and loaded in a cascading fashion. |
|
|
259 |
That is, each image will be loaded only when it comes within <code>foldDistance</code> pixels of the bottom of the viewport. |
|
|
260 |
The effect is that images are loaded as needed as the user scrolls down the page. When you set a <code>foldDistance</code>, |
|
|
261 |
the group automatically gets window <code>scroll</code> and window <code>resize</code> triggers. |
|
|
262 |
<pre class="code prettyprint">var foldGroup = new Y.ImgLoadGroup({ |
|
|
263 |
foldDistance: 30 |
|
|
264 |
}); |
|
|
265 |
foldGroup.registerImage({ |
|
|
266 |
domId: 'partwayDownPageImage', |
|
|
267 |
bgUrl: 'http://www.example.com/image/url' |
|
|
268 |
});</pre> |
|
|
269 |
|
|
|
270 |
</p> |
|
|
271 |
|
|
|
272 |
<h3 id="visibility">Image Visibility</h3> |
|
|
273 |
<p> |
|
|
274 |
You can set your <code><img></code> tags to have the CSS property <code>visibility:hidden</code>. |
|
|
275 |
This will allow your page to keep its structure until the image is actually loaded. Since these images are probably |
|
|
276 |
out of the viewport anyway, this may not make a perceptible difference, but it will help some browsers avoid reflowing |
|
|
277 |
the page when deferred images are loaded. To accomplish this using ImageLoader, set the <code>setVisible</code> |
|
|
278 |
attribute of the image to <code>true</code> when you register the image; ImageLoader will then set the <code>visibility</code> |
|
|
279 |
property to <code>visible</code> when the image is fetched. |
|
|
280 |
</p> |
|
|
281 |
|
|
|
282 |
<h3 id="classnames">Using Class Names</h3> |
|
|
283 |
<p> |
|
|
284 |
As an alternative to registering each image with a group, you can use CSS class names to group images together. |
|
|
285 |
When using this approach, images that are part of the same group should all share a common class name. |
|
|
286 |
Each should also have its image set as the element's background image via CSS in the element's <code>style</code> attribute. |
|
|
287 |
To prevent the image from loading immediately when the element renders, create a CSS style definition for that |
|
|
288 |
class overriding the background image to <code>none</code>. Lastly, set the <code>className</code> attribute of the |
|
|
289 |
ImageLoader group. |
|
|
290 |
</p> |
|
|
291 |
<p> |
|
|
292 |
The following combination of CSS, HTML, and JavaScript illustrates this approach: |
|
|
293 |
<pre class="code prettyprint"><div |
|
|
294 |
class='yui-imgload-somegroup' |
|
|
295 |
style='background-image:url("http://www.example.com/image/url");'> |
|
|
296 |
</div> |
|
|
297 |
|
|
|
298 |
<style> |
|
|
299 |
.yui-imgload-somegroup { |
|
|
300 |
background:none !important; |
|
|
301 |
} |
|
|
302 |
</style> |
|
|
303 |
|
|
|
304 |
<script> |
|
|
305 |
someGroup.set('className', 'yui-imgload-somegroup'); |
|
|
306 |
</script></pre> |
|
|
307 |
|
|
|
308 |
</p> |
|
|
309 |
|
|
|
310 |
|
|
|
311 |
<h2 id="caveats">Important Usage Requirements</h2> |
|
|
312 |
|
|
|
313 |
<p> |
|
|
314 |
There are some important things to keep in mind while using the ImageLoader Utility. |
|
|
315 |
Otherwise it may not work the way you expect, or it may have some undesired side effects. |
|
|
316 |
</p> |
|
|
317 |
|
|
|
318 |
<h3 id="src-attribute-of-source-images">"src" Attribute of Source Images</h3> |
|
|
319 |
<p> |
|
|
320 |
When using ImageLoader with <code><img></code> elements (via the <code>srcUrl</code> attribute), |
|
|
321 |
leave the <code>src</code> attribute out of the HTML element altogether. Do not set an empty string for |
|
|
322 |
the value of <code>src</code>. Some browsers react to this by assuming the empty string means "/", and |
|
|
323 |
consequently the browser re-requests the current HTML page and tries to stuff it into the <code><img></code> element. |
|
|
324 |
This is bad news for performance. |
|
|
325 |
</p> |
|
|
326 |
<p> |
|
|
327 |
<code> |
|
|
328 |
<img id="anImgEl" /> |
|
|
329 |
<br /> |
|
|
330 |
<strike><img id="anImgEl" src="" /></strike> |
|
|
331 |
</code> |
|
|
332 |
</p> |
|
|
333 |
|
|
|
334 |
<h3 id="resizing-images">Resizing Images</h3> |
|
|
335 |
<p> |
|
|
336 |
When resizing <code><img></code> elements (via <code>height</code> and <code>width</code> attributes) on the fly, |
|
|
337 |
the height and width of the image must be specified in the JavaScript. Do this by setting <code>width</code>/<code>height</code> |
|
|
338 |
attributes in the <code>registerImage</code> call. Failure to do this will result in no resizing. Browsers ignore width/height |
|
|
339 |
set in the HTML when there is no <code>src</code> attribute. And when the <code>src</code> is finally set, the width/height end |
|
|
340 |
up being the image's natural size. |
|
|
341 |
</p> |
|
|
342 |
<p> |
|
|
343 |
<code> |
|
|
344 |
someGroup.registerImage({ domId: "someImgDiv", srcUrl: "http://www.example.com/image/url", width: W, height: H }); |
|
|
345 |
<br /> |
|
|
346 |
<strike>someGroup.registerImage({ domId: "someImgDiv", srcUrl: "http://www.example.com/image/url" });</strike> |
|
|
347 |
</code> |
|
|
348 |
</p> |
|
|
349 |
</div> |
|
|
350 |
</div> |
|
|
351 |
</div> |
|
|
352 |
|
|
|
353 |
<div class="yui3-u-1-4"> |
|
|
354 |
<div class="sidebar"> |
|
|
355 |
|
|
|
356 |
<div id="toc" class="sidebox"> |
|
|
357 |
<div class="hd"> |
|
|
358 |
<h2 class="no-toc">Table of Contents</h2> |
|
|
359 |
</div> |
|
|
360 |
|
|
|
361 |
<div class="bd"> |
|
|
362 |
<ul class="toc"> |
|
|
363 |
<li> |
|
|
364 |
<a href="#getting-started">Getting Started</a> |
|
|
365 |
<ul class="toc"> |
|
|
366 |
<li> |
|
|
367 |
<a href="#creating-an-image-group">Creating an Image Group</a> |
|
|
368 |
</li> |
|
|
369 |
<li> |
|
|
370 |
<a href="#adding-images-to-the-group">Adding Images to the Group</a> |
|
|
371 |
</li> |
|
|
372 |
</ul> |
|
|
373 |
</li> |
|
|
374 |
<li> |
|
|
375 |
<a href="#using">Using the ImageLoader Utility</a> |
|
|
376 |
<ul class="toc"> |
|
|
377 |
<li> |
|
|
378 |
<a href="#performance">Performance Considerations</a> |
|
|
379 |
</li> |
|
|
380 |
<li> |
|
|
381 |
<a href="#approach">Approach</a> |
|
|
382 |
</li> |
|
|
383 |
<li> |
|
|
384 |
<a href="#triggers">Triggers</a> |
|
|
385 |
</li> |
|
|
386 |
<li> |
|
|
387 |
<a href="#customtriggers">Custom Event Triggers</a> |
|
|
388 |
</li> |
|
|
389 |
<li> |
|
|
390 |
<a href="#addimages">Adding Images</a> |
|
|
391 |
</li> |
|
|
392 |
<li> |
|
|
393 |
<a href="#fold">Loading Images Below the Fold</a> |
|
|
394 |
</li> |
|
|
395 |
<li> |
|
|
396 |
<a href="#visibility">Image Visibility</a> |
|
|
397 |
</li> |
|
|
398 |
<li> |
|
|
399 |
<a href="#classnames">Using Class Names</a> |
|
|
400 |
</li> |
|
|
401 |
</ul> |
|
|
402 |
</li> |
|
|
403 |
<li> |
|
|
404 |
<a href="#caveats">Important Usage Requirements</a> |
|
|
405 |
<ul class="toc"> |
|
|
406 |
<li> |
|
|
407 |
<a href="#src-attribute-of-source-images">"src" Attribute of Source Images</a> |
|
|
408 |
</li> |
|
|
409 |
<li> |
|
|
410 |
<a href="#resizing-images">Resizing Images</a> |
|
|
411 |
</li> |
|
|
412 |
</ul> |
|
|
413 |
</li> |
|
|
414 |
</ul> |
|
|
415 |
</div> |
|
|
416 |
</div> |
|
|
417 |
|
|
|
418 |
|
|
|
419 |
|
|
|
420 |
<div class="sidebox"> |
|
|
421 |
<div class="hd"> |
|
|
422 |
<h2 class="no-toc">Examples</h2> |
|
|
423 |
</div> |
|
|
424 |
|
|
|
425 |
<div class="bd"> |
|
|
426 |
<ul class="examples"> |
|
|
427 |
|
|
|
428 |
|
|
|
429 |
<li data-description="Demonstrates the basic features and operation of the ImageLoader Utility, deferring the loading of images until specific events happen or specific time limits expire."> |
|
|
430 |
<a href="basic-features.html">Basic Features of the ImageLoader Utility</a> |
|
|
431 |
</li> |
|
|
432 |
|
|
|
433 |
|
|
|
434 |
|
|
|
435 |
<li data-description="Loading images above the fold immediately while deferring the loading of images below the fold."> |
|
|
436 |
<a href="below-fold.html">Loading Images Below the Fold</a> |
|
|
437 |
</li> |
|
|
438 |
|
|
|
439 |
|
|
|
440 |
|
|
|
441 |
<li data-description="Using CSS class names to target specific images for deferred loading."> |
|
|
442 |
<a href="imageloader-class-names.html">Using ImageLoader with CSS Class Names</a> |
|
|
443 |
</li> |
|
|
444 |
|
|
|
445 |
|
|
|
446 |
</ul> |
|
|
447 |
</div> |
|
|
448 |
</div> |
|
|
449 |
|
|
|
450 |
|
|
|
451 |
|
|
|
452 |
</div> |
|
|
453 |
</div> |
|
|
454 |
</div> |
|
|
455 |
</div> |
|
|
456 |
|
|
|
457 |
<script src="../assets/vendor/prettify/prettify-min.js"></script> |
|
|
458 |
<script>prettyPrint();</script> |
|
|
459 |
|
|
|
460 |
<script> |
|
|
461 |
YUI.Env.Tests = { |
|
|
462 |
examples: [], |
|
|
463 |
project: '../assets', |
|
|
464 |
assets: '../assets/imageloader', |
|
|
465 |
name: 'imageloader', |
|
|
466 |
title: 'ImageLoader', |
|
|
467 |
newWindow: '', |
|
|
468 |
auto: false |
|
|
469 |
}; |
|
|
470 |
YUI.Env.Tests.examples.push('basic-features'); |
|
|
471 |
YUI.Env.Tests.examples.push('below-fold'); |
|
|
472 |
YUI.Env.Tests.examples.push('imageloader-class-names'); |
|
|
473 |
|
|
|
474 |
</script> |
|
|
475 |
<script src="../assets/yui/test-runner.js"></script> |
|
|
476 |
|
|
|
477 |
|
|
|
478 |
|
|
|
479 |
</body> |
|
|
480 |
</html> |