In one of my web page When user clicks a thumbnail view of my page then the main Image will show that corresponding

My code as followa

jQuery('products li img').click(function(){

var as=jQuery(this).attr('href');


My doubt is at the time of user clicks on that thumb a small preload will need to show ... Please help

Thanks in advance

This will preload all the images, so they will stand a reasonable chance of being in browser cache when user clicks each thumbnail:

  var img, mainImg = jQuery('#mainImg').get(0);
  jQuery('products li img').each(function(){//loop to preload images immediately
    img = new Image();
    img.src = this.href;
  }).click(function(){//establish onclick handler
    mainImg.src = this.href;


Make sure it's all wrapped in window.onload = function(){...}; or jQuery(document).ready(function(){...}); or similar.