I created a simple jquery slideshow with the help of this tutorial> http://www.hacktweaks.com/2010/09/worlds-smallest-jquery-slideshow.html However I wanted to add some tweaks to it. Before the images are fully loaded, I want to show a rotating GIF icon. The very basic code i tried goes like this, /* this cycles the number from 1 to 3. /* according to HackTweaks m is the total number of slides*/ var m = 3; x += 1; if (x > m) { x = 1; } /* This fades out currently loaded div */ $("DIV.slide:nth-child(n)").fadeOut(function(){ $("DIV.slide:nth-child(n)").removeClass("active")}); /* in the next line, i did something like this to hide the image before and remove loading class and add active class and finally fadein the image. $("DIV.slide:nth-child(" + (x) + ") img").load(function() { $(this).hide(); $("DIV.slide:nth-child(" + (x) + ")").removeClass('loading').addClass('active'); $("DIV.slide:nth-child(" + (x) + ") img").fadeIn(); }); but it's not working... Can any body help?
google jquery Preload and you will find plugin you can use to achieve what you want with lots of different options.
I don't think that you need a plugin to achieve that. All I do on my pages is that I add a div that contains the loading-gif when I start to load an image. So when the .load-function finishes, I have a little callback - function that removes this "loading-div" again. Simple as that