I\'m trying to create a kind of slideshow.
The problem:
function slides(x) {
$(\"#irack\").stop().animate({\"left\": x}, 20);
};
setInterval
The reason it doesn't work is because you're calling the function you're passing to setInterval
You'll need to wrap the function in an anonymous function to pass a parameter as part of the interval.
function slides(x) {
$("#irack").stop().animate({"left": x}, 20);
};
setInterval(function(){slides(-30)},300);
Note how the slides(-30) is now wrapped in an anon function.