views:

43

answers:

1

Say I have the following code in my html:

<html>
  <....> 
   <img src="the-image.gif" />
  <....>
</html>

Is it possible to avoid loading the image using javascript? I want to load it later, using javascript. But I don't want it to be loaded automatically.

I am trying to delay the request of the image.

Thanks

+4  A: 

You can use the LazyLoad jQuery Plugin.

Lazy loader is a jQuery plugin written in JavaScript. It delays loading of images in (long) web pages. Images outside of viewport (visible part of web page) wont be loaded before user scrolls to them. This is opposite of image preloading.

Sarfraz