jquery function setInterval
This is because you are executing the function not referencing it. You should do:
setInterval(swapImages,1000);
Don't pass the result of swapImages
to setInterval
by invoking it. Just pass the function, like this:
setInterval(swapImages, 1000);
// simple example using the concept of setInterval
$(document).ready(function(){var g = $('.jumping');function blink(){ g.animate({ 'left':'50px' }).animate({ 'left':'20px' },1000)}setInterval(blink,1500);});