I'm trying to make a slideshow using Jquery, the pictures are cycled by a function that calls itself every 5.5 seconds. However, I'm trying to avoid recursion since it is very expensive comparing to iterative calls. And I'm assuming that is the cause for IE to have a non-stopping loading icon when my slideshow is loaded. So I want to convert the following function to an iterative one.
function playslides()
{
//hide previous slide
$(document.getElementById(t)).fadeOut("slow");
//reset slide index
calcSildes();
//show new slide
$(document.getElementById(t)).fadeIn("slow");
//recursive call after 5.5 sec
timer = setTimeout("playslides()", 5500);
}
//on page load...
$(document).ready(
playslides();
);
so far my two approaches are:
create a while loop inside the $(document).ready() function and loop playslides() function.
create another timer function that calls the playslides() function, and let playslides function call that timer function. (Not sure if this avoids recursion at all...)
Thanks!!