All I need it to do is run the function animateAds over and over. Can anyone help? This is my code:
function animateAds(n) {
$('#ad_1').fadeIn('slow', function (){
$('#ad_1').delay(100).fadeOut('fast', function (){
$('#ad_2').fadeIn('slow');
});
});
};
$(document).ready(function() {
for (n = 0; n < 10; n++) {
animateAds(n);
}
});
Your code shows a limit of 10, but your question sort of sounds like you want it to be perpetual.
Here’s an example of how it would run perpetually. If you want the limit, then it would be a simple reworking of the
if()statement in the callback.Does this seem close to what you were looking for?
You can add as many elements to the array as you wish, since it simply counts the length of the array.