Reputation: 468
How can a get a jquery animation to run say every 5 seconds?
so for something like this.
$('.zoom_big').animate({opacity: 1},2000,functions()}{
$('.zoom_big').animate({opacity: 0},2000);
});
Upvotes: 0
Views: 3018
Reputation: 15356
You can use javascript's setInterval()
:
var t = setInterval(function(){ // run the following function
$('.zoom_big').animate({opacity: 1},2000,functions()}{
$('.zoom_big').animate({opacity: 0},2000);
});
},5000); // every 5000 milliseconds = 5 seconds
To stop it you can use clearInterval()
clearInterval(t);
Upvotes: 4