Timing for loop changes when using other functions in the computer Jquery -


i have pulsing animation in jsfiddle

http://jsfiddle.net/upbdw/8/

when use on own, works fine. problem i'm having when start browsing web, open itunes or whatever else while window still open, timings of pulses start fluctuate.

the function pulses this:

function fadeitin() {      window.setinterval(function(){          // fade ins         $('#child4,#child4c').fadein(175);         settimeout(function () {             $('#child3,#child3c').fadein(175);         }, 175);         settimeout(function () {             $('#child2,#child2c').fadein(175);         }, 350);         settimeout(function () {             $('#child1,#child1c').fadein(175);         }, 525);         settimeout(function () {             $('#child,#childc').fadein(175);         }, 700);          // fade outs         settimeout(function () {             $('#child,#childc').fadeout(175);         }, 875);         settimeout(function () {             $('#child1,#child1c').fadeout(175);         }, 1050);         settimeout(function () {             $('#child2,#child2c').fadeout(175);         }, 1225);         settimeout(function () {             $('#child3,#child3c').fadeout(175);         }, 1400);         settimeout(function () {             $('#child4,#child4c').fadeout(175);         }, 1575);        }, 3000);    }; 

i feel issue happening during 3 second interval within function. need pulses repeat, need in there.

what think causing problem , how can fix it?

one thing can put 1 set timeout inside one.

right have settimeout(, time); settimeout(, time*2); settimeout(, time*3);

maybe if change to: settimeout(... settimeout(... settimeout(...,time), time), time);

so ensure order of execution. first 1 execution.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -