Hi all,
I'm trying my first bit of jQuery code but am familiar with Java programming. I'm trying to create a function that loads a div with an image in it, which will fade in and then after 4 seconds move onto the next image. I want it to create an infinite loop but it doesn't work.

<script type="text/javascript">
		$(document).ready(function ()
		var slide=true;
		while (slide==true)
			var i=1;
				if (i==2)

How do I fix this?


You WANT it to create an infinite loop? And what is the purpose of the outer loop? What is setTimeout _supposed_ to be doing (you're missing a function parameter to setTimeout)?

I want to create a image slideshow by placing an image in each div. I want it to continue to animate while the user is on the page. So each div will be displayed for 4 seconds, and then another div will fade in and display for 4 seconds.

You don't need a while loop to make a loop, just use setInterval(<repeat every N milliseconds>, <function to execute>);

Loop never solve your issue, because in faction of seconds your loop got ended or become infinite. So please search for some timer function which set intervals like the above reply says. I suggested as a bad programming. Sure in JQuery timer functions would be there? Jquery handled many transition effects. So this is not the way you do. Get into that or google it for an example.