Hi there,
So I’m writing an image slideshow in jQuery, and I have an array of img srcs which I am sending to a function:
function revolve(array, delay){
var src = array[0];
var nextSrc = array[1];
$('#window img[src="' + nextSrc + '"]').css({"z-index": 50});
$('#window img[src="' + src +'"]').css({"z-index": 100}).fadeOut(1000, function(){
$(this).css({"z-index": 0}).show();
});
array.shift();
array.push(src);
[B]timer = setTimeout("revolve(" + array + ", " + delay + ")", delay + 1000);[/B]
}
now, when the script gets down to the last line, I get this error:
Uncaught SyntaxError: Unexpected token ILLEGAL
But when I call the function like so:
revolve(images, 1000);
It runs fine. I only get the error message when I use a setTimeout();
I’m not sure what’s happening because the error message doesn’t make a lot of sense to me, plus I couldn’t find anything that seemed particularly relevant online about it.
Thanks in advance,
Mike