javascript - Multiple timers on the same page don't work smoothly -
i have 3 javascript timers working @ same time on page using settimeout
, functions called these timers not working smoothly , seems timers waiting on each other, , times hang page.
is there best practice when dealing js timers avoid behavior?
examples:
sometimes use jquery timers this:
$(document).everytime(1000, "blinkred", function (i) { $(price).toggleclass('valuered'); }, 10);
and use normal settimeout
javascript function.
the timers not waiting each other, functions called when timer done, are. so, when put blocking code (like alert) in first timer function, prevent other timers go off.
Comments
Post a Comment