Home arrow JavaScript arrow Preloading Images with CSS and JavaScript
JAVASCRIPT

Preloading Images with CSS and JavaScript


While this principle is well known among web developers and designers, it’s worth repeating: never assume that a web site's users will wait patiently for its contents to be delivered. In a world where data must be rendered to the consumer as fast as possible, making this assumption can literally kill any web project, regardless of its size. This multi-part series will show you how to speed up the loading of images on a web site.

Author Info:
By: Alejandro Gervasio
Rating: 3 stars3 stars3 stars3 stars3 stars / 4
February 12, 2010
TABLE OF CONTENTS:
  1. · Preloading Images with CSS and JavaScript
  2. · Using CSS to preload images for a sample web page
  3. · Adding some empty preloaders to the web page
  4. · Working with CSS background graphics

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Preloading Images with CSS and JavaScript
(Page 1 of 4 )

Over the last few years, different approaches have emerged, both on the client and the server sides, aimed at speeding up the transfer of contents over the web. For obvious reasons, methods that rely primarily on a web server, like server-side caching and HTTP compression, are well-trusted allies that can be of great help in making web pages load faster.

Things become more complicated, however, when the aforementioned techniques need to be employed with methods that work in the client, as this is always an unsafe, uncontrolled territory. Does this mean that all is lost when you must use a client-side approach for improving the performance of your website? Not at all! First, you can benefit from the natural ability of browsers to cache static files, including CSS, JavaScript, images and so forth. And second, you can always take advantage of progressive enhancement/graceful degradation and implement a bunch of methods that rely on CSS and JavaScript to preload (AKA eager-loading) content.

Certainly, images are good candidates for preloading and caching later in specific situations, though this concept must be carefully evaluated and applied with caution. I have to say, however, that the idea behind "prefetching" images is very interesting, and it's much easier to implement than you may think. Therefore, in this group of articles I'm going to explore several image preloading techniques that use CSS or JavaScript (or a combination of both). This will let you choose whichever one best suits your needs.

Now, let's discover how to preload images on the client side. Let's go!


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials