erezT erezT - 1 year ago 72
jQuery Question

jQuery: How to time an element's fadeOut while still in loop?

I am looping an element with opacity yet I would like to stop it after 4.8 sec after the document is loaded. The snippet of my loop is here:

var centor = $(".centeror");
function centorRun(){
centor.animate({opacity:'1'}, 700);
centor.animate({opacity:'0.2'}, 700, centorRun);


Every time I run
both out of function and in function scope I get bad results, and I'm thinking delay is not the function I should be using, am I right?

is within the
$("document").ready(function() {}

Answer Source

Try this


Change the time 5000 as mil Second what you like best. 1 sec=1000

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download