Programming Web with PHP, CSS, Javascript and ∞
Speed Up Your Pages With Lazy Load JQuery Plugin
I would like to introduce you this simple but very efficient plugin that will help us speed up the downloading time of our web pages. I am talking about mr Mika Tuupola’s Lazy Load JQuery Plugin.
This plugin loads the images of a web page as the user scrolls to their position, that is, images wont load until they are not within the visible viewport margins of the window.
How to use
First we need to insert the following references into our code
<!-- insert a reference to jquery and the jquery.lazyload plugin --> <script src="jquery.js" type="text/javascript"></script> <script src="jquery.lazyload.js" type="text/javascript"></script>
And now this few lines of code in our document.ready function
<script type="text/javascript">
$(function() {
$("img").lazyload({
placeholder : "img/grey.gif",
effect : "fadeIn"
});
});
< /script>
And that’s it! Easy right?
| Print article | This entry was posted by Antonio Ramirez on June 15, 2010 at 8:06 am, and is filed under How To, JQuery, On The Web, Tools. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |







I'm a 38 year old Web Developer working from Ibiza, Balearic Islands, Spain. I am Founder and Lead Developer for
about 1 month ago
What if you want to apply it only to images with a certain class attribute?
I am doing fade in for a product catalog, but the items go out of the visible area. Since we will have many page views, I am concerned about scrolling areas and tabbed content.
about 1 month ago
Hi Tim,
Sorry for the late reply, I am quite busy nowadays… Well, you shouldn’t be worried, this great plugin takes care of vertical and horizontal areas of the parent control where images are placed in…
Best